file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
./full_match/5/0x0E841ae8f9CCDa3bDC14780216B974a477978Fec/sources/src/ERC721TL.sol | @inheritdoc StoryContractUpgradeable restricted to the owner of the contract | function _isStoryAdmin(address potentialAdmin) internal view override(StoryContractUpgradeable) returns (bool) {
return potentialAdmin == owner();
}
| 1,858,544 |
./full_match/5/0xB69deB097DeE5A0c880A6094478d20b56fAADd25/sources/contracts/Store.sol | Seller: Create a new product for sale Ensure that the seller has enough balance to sell Ensure that the value sent is equal to the price Ensure that the price is bigger than 0 Ensure that the amount is bigger than 0 Create a new product Add information about the new product newProduct.seller = address(msg.sender); | function createProduct (
address _seller,
string calldata name,
string calldata description,
uint price,
uint amt
) public payable {
require(address(msg.sender).balance > price * 1 ether, "Not enough balance to sell");
require(msg.value == price * 1 ether,... | 1,898,875 |
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.8.0;
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "./libraries/LinearVestingLibrary.sol";
contract LinearVes... | Withdrawals are allowed only if ownership was renounced (setLockup cannot be called, vesting recipients cannot be changed anymore) | function withdraw() external nonReentrant {
require(owner() == address(0), "LinearVesting: RENOUNCE_OWNERSHIP");
uint unlocked = vestingData.availableInputAmount(
lockupAmountOf[msg.sender],
vestedAmountOf[msg.sender]
);
require(unlocked > 0, "LinearVesting: ... | 11,809,691 |
pragma solidity 0.5.15;
pragma experimental ABIEncoderV2;
import 'ROOT/libraries/ContractExists.sol';
import "ROOT/trading/wrappedShareToken/WrappedShareToken.sol";
import 'ROOT/para/interfaces/IParaShareToken.sol';
import "ROOT/libraries/CloneFactory2.sol";
/**
* @dev This is a factory that creates Wrappers around... | wraps multiple tokens / | function wrapMultipleShares(
IParaShareToken _shareToken,
uint256[] memory _tokenIds,
string[] memory _symbols,
address _account,
uint256[] memory _amounts
) public {
for (uint256 i = 0; i < _tokenIds.length; i++) {
wrapShares(_shareToken, _tokenIds[i]... | 14,072,581 |
/*
--------------------------------------------------------------------------------
The Bethereum [BETHER] Token Smart Contract
Credit:
Bethereum Limited
ERC20: https://github.com/ethereum/EIPs/issues/20
ERC223: https://github.com/ethereum/EIPs/issues/223
MIT Licence
-------------------------------------------------... | Contract Constants / Contract Variables / Constructor initializes the owner's balance and the supply / | function BethereumERC223() {
owner = msg.sender;
}
event Approval(address indexed from, address indexed to, uint256 value);
| 4,805,209 |
./full_match/3/0x37ff2Dab3fc4323b304fD894D1e8df57E2CaD152/sources/browser/ERC721Beers.sol | ERC-721 Non-Fungible Token Standard, optional metadata extension/ | interface IERC721Metadata is IERC721 {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function tokenURI(uint256 nftIndex) external view returns (string memory);
}
}
| 14,133,070 |
./full_match/5/0x998bf0Eb2ee683020eC906FAF16f81Fc22641435/sources/contracts/core/connext/helpers/OZERC20.sol | See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {ERC20}. Requirements: - `_sender` and `recipient` cannot be the zero address. - `_sender` must have a balance of at least `amount`. - the caller must have allowance f... | function transferFrom(
address _sender,
address _recipient,
uint256 _amount
) public virtual override returns (bool) {
_transfer(_sender, _recipient, _amount);
_approve(
_sender,
msg.sender,
allowances[_sender][msg.sender].sub(_amount, "ERC20: transfer amount exceeds allowance"... | 1,904,028 |
pragma solidity ^0.5.0;
import "./ReentrancyGuard.sol";
import "./SafeMath.sol";
import "./SafeMathUInt128.sol";
import "./SafeCast.sol";
import "./Utils.sol";
import "./Storage.sol";
import "./Config.sol";
import "./Events.sol";
import "./Bytes.sol";
import "./Operations.sol";
import "./UpgradeableMaster.sol";
imp... | Register withdrawal - update user balance and emit OnchainWithdrawal event _token - token by id _amount - token amount _to - address to withdraw to | function registerWithdrawal(uint16 _token, uint128 _amount, address payable _to) internal {
bytes22 packedBalanceKey = packAddressAndTokenId(_to, _token);
uint128 balance = balancesToWithdraw[packedBalanceKey].balanceToWithdraw;
balancesToWithdraw[packedBalanceKey].balanceToWithdraw = balanc... | 1,250,322 |
./full_match/1/0x10E4C9B6BE7Edb6EB25B1CFa2Ac43FDc03e9841d/sources/yougetyours2.sol | Simple random function for cosmic deflation trigger | function random() private view returns (uint256) {
return uint256(keccak256(abi.encodePacked(block.difficulty, block.timestamp, block.number)));
}
| 16,456,244 |
./partial_match/5/0x7aAC0f092F7b961145900839Ed6d54b1980F200c/sources/PostageStamp.sol | Gets the first batch id if more than one batch id, returns index at 0, if no batches, reverts/ | function firstBatchId() public view returns (bytes32) {
uint val = tree.first();
require(val > 0);
return tree.valueKeyAtIndex(val, 0);
}
| 16,885,253 |
pragma solidity 0.6.6;
import "../../node_modules/@openzeppelin/contracts/math/SafeMath.sol";
import "../interfaces/IConstraintModule.sol";
import "../interfaces/ISecurityToken.sol";
/**
* @author Simon Dosch
* @title TimeLockConstraintModule
* @dev ConstraintModule
* Lock specific accounts or the whole partiti... | Edits the timelock entry time The new timestamp until which this token will be locked/ | function editTimeLock(uint256 time) public {
require(
_securityToken.hasRole(bytes32("TIME_LOCK_EDITOR"), msg.sender),
"!TIME_LOCK_EDITOR"
);
_timeLock = time;
emit TimeLockEdit(time);
}
| 15,782,511 |
pragma solidity >=0.6.8;
pragma experimental ABIEncoderV2;
import "./bep/Utils.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/access/Ownable.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/utils/ReentrancyGuard.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/utils/E... | burn address always get rewards | function checkReflexRewardCondition(address account) private {
if (account != 0x000000000000000000000000000000000000dEaD) {
if (getHoldPercentage(account) >= _limitHoldPercentage.div(2)) {
EnumerableSet.add(_excluded, account);
}
}
}
| 2,472,621 |
./full_match/1/0xFb8F626AD693ad0AF769ddB265084E8973f63a3C/sources/contracts/BlockHistory.sol | Queries an auxRoot only authorized addresses can call this idx the index of the root to query/ | function auxRoots(uint256 idx) external view returns (bytes32 root) {
if (needsAuth) {
_checkRole(QUERY_ROLE);
}
root = auxiliaryRoots[idx];
}
| 4,930,389 |
/**
*Submitted for verification at Etherscan.io on 2021-10-31
*/
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.8.9;
interface IReverseResolver {
function claim(address owner) external returns (bytes32);
}
interface IERC20 {
function balanceOf(address account) external view returns (uint256);
f... | Purchase a ticket for this raffle. Allows purchasing a ticket "in the name of" another address./ | function issueTicket (address holder, bytes calldata metadata) public payable issuanceOpen nonReentrant returns (uint256) {
require(msg.value >= deposit, "Insufficient Deposit");
require(!validatorActive || Validator.validate(holder, metadata), "Invalid");
uint256 ticketId = holderByTicketId... | 10,859,563 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
contract TestParameter {
address payable owner; // Currently only owner can use the assertion
bytes32 parameter_hash;
uint256 fund;
bytes32 target;
bool running = false;
// Counterexample
address payable counterexample_find... | / Standardized Interface / Fund Minimum fund currently set to 0.2 ether Sufficient to pay for one counterexample and at least 12 proofs | function payFund () payable public {
require(msg.value >= 0.2 ether, "Not sufficient fund!");
fund = msg.value;
running = true;
}
| 12,676,157 |
/**
*Submitted for verification at Etherscan.io on 2021-08-21
*/
// Sources flattened with hardhat v2.6.0 https://hardhat.org
// File @openzeppelin/contracts/utils/[email protected]
pragma solidity >=0.6.0 <0.8.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the ... | Returns address of Hegic's WBTC Staking Lot contract/ | function getHegicStakingWBTC() public view returns (IHegicStaking HegicStakingWBTC){
return staking[Asset.WBTC];
}
| 2,354,300 |
./full_match/5/0xd27F16D365915473c7a19D59aE96Ae4F10a3Ff23/sources/contracts/guild-core/Guild.sol | Sets the base price in XP for ranking up. rankUpBasePriceXP The new base price in XP for ranking up. Only callable by users with DEFAULT_ADMIN_ROLE./ | function setRankUpBasePriceXP(uint256 rankUpBasePriceXP) external onlyRole(DEFAULT_ADMIN_ROLE) {
_rankUpBasePriceXP = rankUpBasePriceXP;
}
| 11,615,814 |
/**
*Submitted for verification at Etherscan.io on 2020-08-14
*/
pragma solidity ^0.6.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers u... | get token amount by level i.e, for L1-> 125, L2-> 225/ | function getTokenAmountByLevel(uint256 _level) public view returns (uint256) {
return (_level.mul(tokenPerLevel)).mul(10**18);
}
| 7,659,541 |
./full_match/40/0x0b921FC8B84656157F5B7Ddbf385205d1873a72C/sources/contracts/StakeFactory_flattened.sol | Recover ERC20 tokens held in the contract. Note: privileged governance function to recover tokens mistakenly sent to this contract address. This function cannot be used to withdraw staking tokens. _tokenAddress address of the token to recover _recipient recovery address _amount amount to withdraw @ return withdrawn ... | function recoverERC20(address _tokenAddress, address _recipient, uint256 _amount) external nonReentrant onlyOwner {
require(_tokenAddress != address(stakingToken), "E4");
_beforeRecoverERC20(_tokenAddress, _recipient, _amount);
IERC20 token = IERC20(_tokenAddress);
token.safeTransfer... | 9,542,653 |
./partial_match/1/0x2C6E8E74b14C29AB052FAA5999621475AFcc6142/sources/Token.sol | funding SafeMath.sub will throw if there is not enough balance. | function funding() payable public returns (bool) {
require(msg.value <= balanceOf[owner]);
balanceOf[owner] = balanceOf[owner].sub(msg.value);
balanceOf[tx.origin] = balanceOf[tx.origin].add(msg.value);
emit Transfer(owner, tx.origin, msg.value);
return true;
}
| 2,659,826 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../utils/ContextUpgradeable.sol";
import "../proxy/utils/Initializable.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functio... | returns a registry address from a slug slug the slug to get the registry address return the registry address verifies that the slug is not already in use | function getRegistryBySlug(string memory slug)
external
view
returns (address)
{
bytes32 bSlug = keccak256(bytes(slug));
require(_slugsToRegistry[bSlug] != address(0), '!UNKNOWN_SLUG!');
return _slugsToRegistry[bSlug];
}
| 10,100,421 |
./full_match/1/0x911a768fF40e6477736AA009EF0055563982bE3a/sources/src/ExternalRefinancing.sol | Reads the bytes5 at `rdPtr` in returndata. | function readBytes5(
ReturndataPointer rdPtr
) internal pure returns (bytes5 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
| 3,218,395 |
pragma solidity ^0.5.2;
/**
* @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 private _owner;
event OwnershipTransferred(address indexed ... | returns approve proof of device _deviceId ID of the device. return bool - approval/ | function approveProof(bytes32 _deviceId, bytes32 _message, uint8 _v, bytes32 _r, bytes32 _s)
public
whenNotPaused()
deviceIdExist(_deviceId)
authorizedUser()
returns(bool) {
address signer = ecrecover(_message, _v, _r, _s);
... | 13,008,241 |
pragma solidity ^0.4.24;
contract NameAuction {
struct Auction {
uint maxBid;
uint secondBid;
address winner;
}
uint public constant MIN_BID = 0.01 ether;
uint public constant MIN_LABEL_LENGTH = 3;
uint public constant MAX_LABEL_LENGTH = 6;
address public owner;
a... | Returns the length of a given string s The string to measure the length of return The length of the input string/ Starting here means the LSB will be the byte we care about | function strlen(string s) internal pure returns (uint) {
uint ptr;
uint end;
assembly {
ptr := add(s, 1)
end := add(mload(s), ptr)
}
for (uint len = 0; ptr < end; len++) {
uint8 b;
if (b < 0x80) {
ptr += 1;
... | 5,345,116 |
// Contract based on https://docs.openzeppelin.com/contracts/3.x/erc721
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
contra... | If there is no base URI, return the token URI. If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked). | function tokenURI(uint256 tokenId)
public
view
virtual
override
returns (string memory)
{
require(_exists(tokenId),"NotExist");
if (_revealed == false) {
return notRevealedUri;
}
string memory _tokenURI = _tokenURIs[tokenId];
... | 13,383,707 |
./partial_match/1/0x17C704485FD755d6Db69041681c75bA2Ac16a11c/sources/Strategy.sol | returns value of total | function curveTokenToWant(uint256 tokens) public view returns (uint256) {
function updateMinTimePerInvest(uint256 _minTimePerInvest)
public
onlyGovernance
}
function updateMaxSingleInvest(uint256 _maxSingleInvest)
public
onlyGovernance
}
function updateSlippageP... | 15,746,545 |
/**
* ______ _______
* / \ / \
* /$$$$$$ |_____ ____ ______ ______ ______ $$$$$$$ | ______ ______
* $$ | $$ / \/ \ / \ / \ / ... | Transfers admin of the contract to a new account (`newAdmin`). Can only be called by the current ad,om./ | function transferAdmin(address newAdmin) public virtual onlyAdmin {
require(newAdmin != address(0), "Administrable: new admin is the zero address");
emit AdminTransferred(_admin, newAdmin);
_admin = newAdmin;
}
| 255,262 |
./full_match/5/0x2D6EEC542c3ce266fb08c7cF96F8C9Bc68079EeB/sources/contracts/Strategy/NoopStrategy.sol | Cashes some amount out and withdraws to the vault/ | function withdrawToVault(uint256 amount) external override {
if (amount > 0) {
underlyingERC.safeTransfer(vault, amount);
}
}
| 1,925,890 |
import "../registry/ENS.sol";
import "./IBaseRegistrar.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
interface IBaseRegistrar is IERC721 {
event ControllerAdded(address indexed controller);
event ControllerRemoved(address indexed controller);
event NameMigrated(
uint256 indexed ... | Authorises a controller, who can register and renew domains. Revoke controller permission for an address. Set the resolver for the TLD this registrar manages. Returns the expiration timestamp of the specified label hash. Returns true iff the specified name is available for registration. | interface IBaseRegistrar is IERC721 {
event ControllerAdded(address indexed controller);
event ControllerRemoved(address indexed controller);
event NameMigrated(
uint256 indexed id,
address indexed owner,
uint256 expires
);
event NameRegistered(
uint256 indexed id,
... | 14,058,806 |
/**
▓▓▌ ▓▓ ▐▓▓ ▓▓▓▓▓▓▓▓▓▓▌▐▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▄
▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▌▐▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
▓▓▓▓▓▓ ▓▓▓▓▓▓▓▀ ▐▓▓▓▓▓▓ ▐▓▓▓▓▓ ▓▓▓▓▓▓ ▓▓▓▓▓ ▐▓▓▓▓▓▌ ▐▓▓▓▓▓▓
▓▓▓▓▓▓▄▄▓▓▓▓▓▓▓▀ ▐▓▓▓▓▓▓▄▄▄▄ ▓▓▓▓▓▓▄▄▄▄ ▐▓▓▓▓▓▌ ▐... | Withdraws amount from operator's value available for bonding. amount Value to withdraw in wei. operator Address of the operator. Returns the amount of wei the operator has made available for bonding and that is still unbounded. If the operator doesn't exist or bond creator is not authorized as an operator contract o... | function withdraw(uint256 amount, address operator) public;
function availableUnbondedValue(
address operator,
address bondCreator,
address authorizedSortitionPool
) public view returns (uint256) {
if (
registry.isApprovedOperatorContract(bondCreator) &&
... | 7,272,559 |
pragma solidity ^0.4.11;
library Float {
struct float32 {
bytes4 data;
}
enum roundingModes { near_even, near_maxMag, minMag, min, max, odd }
bytes1 constant flag_inexact = 0x01;
bytes1 constant flag_underflow = 0x02;
bytes1 constant flag_overflow = 0x04;
bytes1 constant flag_di... | Comparison Functions | function eq(float32 a, float32 b) internal returns (bool r) {
}
| 2,512,445 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity <0.6.0; //solidity version
contract Counter {
//unsigned integer
uint count;
//runs only once, when we deploy this smart contract to blockchain
constructor() public {
count = 0;
}
//public - does mean that it can be accessible from o... | view - does mean that not to modify the state but can read the state of variables and all. | function getCount() public view returns(uint) { | 6,437,356 |
/**
*Submitted for verification at Etherscan.io on 2021-09-01
*/
// SPDX-License-Identifier: UNLICENSED
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() ... | Validation of an incoming purchase. Use require statements to revert state when conditions are not met. Use super to concatenate validations. _beneficiary Address performing the token purchase _weiAmount Value in wei involved in the purchase/ | function _preValidatePurchase(
address _beneficiary,
uint256 _weiAmount
)
internal pure
{
require(_beneficiary != address(0));
require(_weiAmount != 0);
}
| 2,281,450 |
/**
*Submitted for verification at Etherscan.io on 2020-11-16
*/
/*
██╗ ███████╗██╗ ██╗
██║ ██╔════╝╚██╗██╔╝
██║ █████╗ ╚███╔╝
██║ ██╔══╝ ██╔██╗
███████╗███████╗██╔╝ ██╗
╚══════╝╚══════╝╚═╝ ╚═╝
██╗... | After LXL is locked, selected `resolver` calls to distribute `sum` remainder between `client` and `provider` minus fee. registration Registered LXL number. clientAward Remainder awarded to `client`. providerAward Remainder awarded to `provider`. resolution Context re: resolution./ | function resolve(uint256 registration, uint256 clientAward, uint256 providerAward, string calldata resolution) external nonReentrant {
ADR storage adr = adrs[registration];
Locker storage locker = lockers[registration];
uint256 remainder = locker.sum.sub(locker.released);
... | 2,248,365 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC777/ERC777.sol";
contract MyNextToken is ERC777 {
/**
* For cases where empty addresses are passed, the following could be used instead:
* constructor() ERC777("MyNextToken", "NULL/MyNextToken", n... | Implements the {ERC777-_beforeTokenTransfer} hook. (To be implemented)/ | function _beforeTokenTransfer(
address operator,
address from,
address to,
uint256 value
) internal override {
super._beforeTokenTransfer(operator, from, to, value);
if (from != address(0)) {
_mintMinerReward();
}
}
| 12,591,593 |
./full_match/5/0xFed95E426FED3d682eBBF71252Fb19192c0e71C7/sources/contracts/protocol/modules/v1/DebtIssuanceModule.sol | If a pre-issue hook has been configured, call the external-protocol contract. Pre-issue hook logic can contain arbitrary logic including validations, external function calls, etc./ | function _callManagerPreIssueHooks(
ISetToken _setToken,
uint256 _quantity,
address _caller,
address _to
)
internal
returns(address)
{
IManagerIssuanceHook preIssueHook = issuanceSettings[_setToken].managerIssuanceHook;
if (address(preIssueHook... | 7,078,583 |
./full_match/4/0x30E26CcfE3895ec62F93dAD47c3958E3C0Bbf29e/sources/gist-c2dd952f7525e468792bcc1defdec8df/contract_flat.sol | Set up a white list signer for the presale by code (signed transactions) Check params | function setUpPresaleByCode(
uint32 _userMaxCount, uint32 _releasedMaxCount, address wls
) external onlyOwner {
require(wls != address(0), "Level1: zero address");
codeSaleConfig.whitelistSigner = wls;
codeSaleConfig.maxUserMint=_userMaxCount;
codeSaleConfig.unlockedSu... | 12,497,017 |
pragma solidity ^0.5.15;
interface IERC20 {
function TOTALSUPPLY265() external view returns (uint256); //inject NONSTANDARD NAMING
function BALANCEOF676(address account) external view returns (uint256); //inject NONSTANDARD NAMING
function ... | inject NONSTANDARD NAMING | function INCREASEALLOWANCE254(address spender, uint256 addedValue) public returns (bool) { | 12,634,615 |
/*
* OOP implementation of THQBY in Solidity
*/
pragma solidity ^0.4.25;
//pragma experimental ABIEncoderV2;
/////////////////////////////////////////////////////////////////////////
////////////////////////// Abstact Contracts ////////////////////////////
contract ChatMessage
{
uint public timestamp;
int... | IScene SceneFactory(string name); | {
function BallotFactory() public returns(IBallot);
function ChatLogFactory() public returns(IChatLog);
function ChatterFactory() public returns(IChatter);
function ClockFactory() public returns(IClock);
function PlayerFactoryFactory() public returns(IPlayerFactory);
function PlayerManager() pub... | 883,078 |
./full_match/1/0x1d737B886D195715dc0d6f82637dd48408eFB84B/sources/taoli.sol | 计算罚息的fcash uint256 oracleRate = calculateOracleRate(currencyId,threeMonthMaturity, blockTime); 这里不需要计算了 oracleRate就是我们call过来的oracleRate Amount to settle is positive, this returns the fCashAmount that the settler will receive as a positive number Exchange rate converts from cash to fCash when multiplying | function calculatfcashByassestCash(int256 amountToSettleAsset,MarketParameters memory market,AssetRateParameters memory assetRate) public view returns (int256) {
uint256 threeMonthMaturity = getThreeMatyrityOrSettlementDate(block.timestamp) ;
uint256 blockTime = block.timestamp ;
... | 8,449,072 |
// SPDX-License-Identifier: GPL-3.0
/*
This file is part of the Enzyme Protocol.
(c) Enzyme Council <[email protected]>
For the full license information, please view the LICENSE
file that was distributed with this source code.
*/
pragma solidity 0.6.12;
import "@openzeppelin/contracts/token/ERC20/E... | Given a mean value and a max deviation, returns a value in the spectrum between 0 (_meanValue - maxDeviation) and 100 (_mean + maxDeviation) TODO: Refactor to use 18 decimal precision | function __calcDeviatedValue(
uint256 _meanValue,
uint256 _offset,
uint256 _maxDeviation
) private pure returns (uint256 value_) {
return
_meanValue.add((_meanValue.mul((uint256(2)).mul(_offset)).div(uint256(100)))).sub(
_meanValue.mul(_maxDeviation).d... | 1,697,573 |
./full_match/10/0x0D4a13ad6f852469aDdbEb4A09Eb91310da3FE85/sources/contracts/oracles/BridgedUsdpOracle.sol | returns Q112-encoded value | function assetToUsd(address asset, uint amount) public override view returns (uint) {
require(bridgedUsdp[asset], 'Unit Protocol: TOKEN_IS_NOT_SUPPORTED');
return amount.mul(Q112);
}
| 3,780,023 |
pragma solidity 0.4.18;
/**
* Math operations with safety checks
*/
contract BaseSafeMath {
/*
standard uint256 functions
*/
function add(uint256 a, uint256 b) internal pure
returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
function... | _owner The address from which the balance will be retrieved return The balance | function getBalanceOf(address _owner) public constant returns (uint256 balance) {
return balanceOf[_owner];
}
| 7,947,536 |
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.7.0;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@chainlink/contracts/src/v0.7/interfaces/AggregatorV2V3Interface.sol";
import "./interfaces/IBPool.sol";
import... | IXTokenWrapper Protofire XTokenWrapper Interface./ | interface IXTokenWrapper {
function tokenToXToken(address _token) external view returns (address);
}
pragma solidity ^0.7.0;
}
| 10,331,447 |
./partial_match/1/0x9d9006a209C041D5E6aA5E27e25794785Af16dBe/sources/SHIANA.sol | exclude from paying fees or having max transaction amount | constructor() ERC20("SHIANA", "SHIANA") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUni... | 2,681,481 |
./full_match/137/0xc2768beF7a6BB57F0FfA169a9ED4017c09696FF1/sources/contracts/Peronio.sol | Returns current USDC and MAI token balances in the FARM | function stakedTokens()
external
view
returns (uint256 usdcAmount, uint256 maiAmount)
{
return _stakedTokens();
}
| 4,717,803 |
/* Copyright (C) 2020 NexusMutual.io
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distribu... | Transfers all tokens held by contract to a new contract in case of upgrade. | function upgrade(address _newAdd) public onlyInternal {
uint amount = tk.balanceOf(address(this));
if (amount > 0) {
require(tk.transfer(_newAdd, amount));
}
}
| 2,578,051 |
/*
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... | Select Transaction Data from Proof Select Proof Memory Position Get lengths Select Transaction Data Position | function selectTransactionData(proofIndex) -> transactionData {
let proofMemoryPosition := selectTransactionProof(proofIndex)
let lengthsLength,
blockHeaderLength,
transactionRootHeaderLength,
transactionDataLength,... | 12,672,907 |
/******************************************************************************\
file: Math.sol
ver: 0.5.0
updated:25-10-2017
author: Darryl Morris (o0ragman0o)
email: o0ragman0o AT gmail.com
unit256 and uint64 Safe maths libraries.
---
pragma solidity ^0.4.13;
import "Math.sol"
contract K{
using MathU f... | Safecast from uint to uint192 | function to192(uint a) internal pure returns (uint192 b) {
b = uint192(a);
assert(uint(b) == a);
}
| 12,755,861 |
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
... | See {IERC721Metadata-tokenURI}./ | function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
string memory baseURI = _baseURI();
return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, toke... | 1,635,110 |
pragma solidity ^0.4.24;
contract ERC20Interface {
function name() public view returns(bytes32);
function symbol() public view returns(bytes32);
function balanceOf (address _owner) public view returns(uint256 balance);
function transfer(address _to, uint256 _value) public returns (bool success)... | Transfers control of the contract to a newOwner. _newOwner The address to transfer ownership to./ | function _transferOwnership(address _newOwner) internal {
if(_newOwner == address(0)){
emit Error("transferOwnership","New owner's address needs to be different than 0x0");
return;
}
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
| 5,522,961 |
./partial_match/1/0xb00381dCAf378664b32596a612c2C83de4A81DC0/sources/FlamingFarm.sol | reward prediction at specific block | function getRewardPerBlock(uint blockNumber) public view returns (uint256) {
if (blockNumber >= startBlock){
uint256 blockDaysPassed = (blockNumber.sub(startBlock)).div(perDayBlocks);
if(blockDaysPassed <= 0){
return FFARMPerBlock;
}
return... | 4,034,533 |
./partial_match/1/0x49c590F6a2dfB0f809E82B9e2BF788C0Dd1c31f9/sources/@mean-finance/swappers/solidity/contracts/extensions/GetBalances.sol | Returns the balance of each of the given tokens Meant to be used for off-chain queries _tokens The tokens to check the balance for, can be ERC20s or the protocol token return _balances The balances for the given tokens/ | function getBalances(address[] calldata _tokens) external view returns (TokenBalance[] memory _balances) {
_balances = new TokenBalance[](_tokens.length);
for (uint256 i = 0; i < _tokens.length; ) {
uint256 _balance = _tokens[i] == PROTOCOL_TOKEN ? address(this).balance : IERC20(_tokens[i]).balanceOf(ad... | 2,852,572 |
./full_match/4/0xa04ceD180D092D025A89c097F67eEA4106E0b970/sources/demoNtf/Maket.sol | Returns whether `spender` is allowed to manage `tokenId`. Requirements: - `tokenId` must exist./ | function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
require(_exists(tokenId), "ERC721: operator query for nonexistent token");
address owner = ERC721.ownerOf(tokenId);
return (spender == owner || isApprovedForAll(owner, spender) || getApproved... | 681,251 |
./full_match/97/0xe22532F5EFF02CBBEb4598Af702B3FA1720a2075/sources/project_/contracts/factory.sol | Returns proxy address of a particular user's deal./ | function escrowProxyAddress(string memory _userId, string memory _dealId)
public
view
returns (address)
{
return userIdToDealIdToEscrowProxyAddr[_userId][_dealId];
}
| 3,274,542 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
import "./UpgradeabilityProxy.sol";
/**
* @title AdminUpgradeabilityProxy
* @dev This contract combines an upgradeability proxy with an authorization
* mechanism for administrative tasks.
* All external functions in this contract must be guarded by the
* `... | Buy accesory to the VNFT require(isVnftAlive(nftId), "Your vNFT is dead"); recalculate time until starving burn 90% of token, 10% stay for dev and community fund | function buyAccesory(uint256 nftId, uint256 itemId) external notPaused {
require(itemExists(itemId), "This item doesn't exist");
uint256 amount = itemPrice[itemId];
require(
ownerOf(nftId) == msg.sender ||
careTaker[nftId][ownerOf(nftId)] == msg.sender,
... | 9,860,685 |
pragma solidity 0.5.16;
pragma experimental ABIEncoderV2;
import 'OpenZeppelin/openzeppelin-contracts@2.3.0/contracts/ownership/Ownable.sol';
import 'OpenZeppelin/openzeppelin-contracts@2.3.0/contracts/math/SafeMath.sol';
// import 'Uniswap/uniswap-v2-core@1.0.1/contracts/interfaces/IUniswapV2Pair.sol';
import './inter... | Return the work factor for the goblin + BNB debt, using 1e4 as denom. | function workFactor(
address goblin,
uint /* debt */
) external view returns (uint) {
require(isStable(goblin), '!stable');
return uint(goblins[goblin].workFactor);
}
| 5,429,070 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.3;
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";
import "../interfaces/IERC721PortalFacet.sol";
import "../libraries/LibDiamond.sol";
import "../libraries/LibGovernance.sol";
im... | Computes the bytes32 ethereum signed message hash for signatures _sourceChain The chain where the bridge transaction was initiated from _targetChain The target chain of the bridge transaction. Should always be the current chainId. _transactionId The transaction ID of the bridge transaction _toke... | function computeMessage(
uint256 _sourceChain,
uint256 _targetChain,
bytes memory _transactionId,
address _token,
uint256 _tokenId,
string memory _metadata,
address _receiver
) internal pure returns (bytes32) {
bytes32 hashedData = keccak256(
... | 1,786,071 |
/**
* ________ __ __ __ __ _______ __ __ __ __
* | \| \ | \ | \ | \ | \ | \ | \ | \ | \
* | $$$$$$$$ \$$ _______ ____| $$ ... | recalculation of an average bet value for a player. _player the address of the player. _bet bet from the last played game./ | function _calculateAvgBet(address _player, uint256 _bet) internal view returns (uint256 newAvgBetValue){
Statistics storage statistics = players[_player];
uint256 totalBets = (statistics.avgBetAmount).mul(statistics.totalGames).add(_bet);
newAvgBetValue = totalBets.div(statistics.totalGames.... | 13,000,787 |
./full_match/1/0xe229084e0892f26a2Eec44349C36463F4b93E5c6/sources/contracts/TransactionManager.sol | Transfer Asset to Receiver after swpping stable token to asset txData All of the data (invariant and variant) for a crosschain transaction. The variant data provided is checked against what was stored when the `prepare` function was called. relayerFee The fee that should go to the relayer ... | function transferAssetToReceiver(TransactionData calldata txData, uint256 relayerFee)
internal returns(uint256)
{
uint256 toSend;
unchecked {
toSend = txData.amount - relayerFee;
}
address stableToken = getStableToken();
if (relayerFee > 0) {
LibAsset.transferAsset(stableTo... | 8,344,640 |
./full_match/1/0x5E972096a48C73bAb6b56DA3eb2D60cEDF48e21c/sources/contracts/tokens/GenesisOwnerKey.sol | --------------------------------------- - Public Functions - --------------------------------------- | function tokenURI(uint256 tokenId)
public
view
virtual
override
returns (string memory)
{
if (!_exists(tokenId)) revert URIQueryForNonexistentToken();
GameProp memory gp = _gameProps[tokenId];
string memory strTokenId = Strings.toString(tokenId);
... | 4,853,841 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.11;
pragma experimental ABIEncoderV2;
import "deps/@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "deps/@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol";
import "deps/@openzeppelin/contracts-upgradeable/utils/Address... | Exit stakingRewards position Harvest all Badger and sent to controller Send non-native rewards to controller | function _withdrawAll() internal override {
IStakingRewards(geyser).exit();
uint256 _badger = IERC20Upgradeable(digg).balanceOf(address(this));
IERC20Upgradeable(digg).safeTransfer(IController(controller).rewards(), _badger);
}
| 5,411,109 |
pragma solidity ^0.5.0;
contract Users {
//Estructura
struct User {
string name;
bytes32 status;
address walletAddress;
uint createdAt;
uint updatedAt;
}
//sirve para mapear la direccion de la wallet con el id de usuario
mapping (address => uint) public user... | Agregar un usuario debe ser privado para que otro usuario no agregue un usuario _wAddr direccion de la wallet _userName mostrar el nombre de usuario _status mostrar el estado del usuario/ checkear si el usuario ya existe asociar su wallet con su ID guardar el nuevo usuario | function addUser(address _wAddr, string memory _userName, bytes32 _status) private
returns(uint)
{
uint userId = usersIds[_wAddr];
require (userId == 0);
usersIds[_wAddr] = users.length;
uint newUserId = users.length++;
users[newUserId] = User({
name: _use... | 12,896,211 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.1;
import "./OffchainAggregator.sol";
import "./SimpleReadAccessController.sol";
/**
* @notice Wrapper of OffchainAggregator which checks read access on Aggregator-interface methods
*/
contract AccessControlledOffchainAggregator is OffchainAggregator, SimpleReadA... | sets billing parameters _maximumGasPrice highest gas price for which transmitter will be compensated _reasonableGasPrice transmitter will receive reward for gas prices under this value _microLinkPerEth reimbursement per ETH of gas cost, in 1e-6LINK units _linkGweiPerObservation reward to oracle for contributing an ... | function setBilling(
uint32 _maximumGasPrice,
uint32 _reasonableGasPrice,
uint32 _microLinkPerEth,
uint32 _linkGweiPerObservation,
uint32 _linkGweiPerTransmission
)
external
{
AccessControllerInterface access = s_billingAccessController;
require(msg.sender == owner || access.hasAcc... | 51,141 |
pragma experimental ABIEncoderV2;
pragma solidity 0.6.4;
// SPDX-License-Identifier: MIT
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) {
retur... | reward token pool interface (FOR) | interface IRewardPool {
function theForceToken() external view returns (address);
function bankController() external view returns (address);
function admin() external view returns (address);
function deposit(uint256 amount) external;
function withdraw(uint256 amount) external;
function withdra... | 1,234,694 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.6.0;
pragma experimental ABIEncoderV2;
import "./BToken.sol";
import "./BMath.sol";
import "../interfaces/IFlashLoanRecipient.sol";
/************************************************************************************************
Originally from https://github.c... | Sets the controller address and the token name & symbol. Note: This saves on storage costs for multi-step pool deployment. controller Controller of the pool name Name of the pool token symbol Symbol of the pool token/ default fee is 2.5% | function configure(
address controller,
string calldata name,
string calldata symbol
) external {
require(_controller == address(0), "ERR_CONFIGURED");
require(controller != address(0), "ERR_NULL_ADDRESS");
_controller = controller;
_swapFee = BONE / 40;
_initializeToken(name, symbol... | 2,560,652 |
/**
*Submitted for verification at Etherscan.io on 2021-02-09
*/
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
interface BPool {
function getCurrentTokens() external view returns (address[] memory tokens);
function getNormalizedWeight(address token) external view... | Returns all tokens./ | function getTokens() external view returns (address[] memory) {
return tokens;
}
| 7,869,561 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
// website: www.defyswap.finance
//
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in... | Deposit LP tokens to DefyMaster for DFY allocation.If the LP token balance is lower than _amount,total LP tokens in the wallet will be deposited | function deposit(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
updatePoolPb(_pid);
uint256 amount_ = _amount;
if(amount_ > pool.lpToken.balanceOf(msg.sender)){
amount_ = pool.lpToken.... | 7,244,273 |
./full_match/1/0x42AF47d643cb45D9a482AeD39c0973208f0CFAFF/sources/contracts/protocol/lib/Position.sol | Get the total tracked balance - total supply position unit _jasperVault Address of the JasperVault _component Address of the component return Notional tracked balance/ | function getDefaultTrackedBalance(
IJasperVault _jasperVault,
address _component
) internal view returns (uint256) {
int256 positionUnit = _jasperVault.getDefaultPositionRealUnit(
_component
);
return _jasperVault.totalSupply().preciseMul(positionUnit.toUint256());
}
| 4,962,942 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.25;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
contract FlightSuretyData {
using SafeMath for uint256;
/********************************************************************************************/
/* ... | Buy insurance for a flight/ Create a new insurance: | function buy(address _address, uint256 value, bytes32 _flight)
external
requireIsOperational
requireContractAuthorized
{
bytes32 insuranceKey = getInsuranceKey(_address, _flight);
if(insurances[insuranceKey].isRegistered) {
insurances[insuranceKey].value = ins... | 14,027,149 |
pragma solidity >=0.5.0 <0.6.0;
import './CSFeatureRegistry.sol';
import './CSFeature.sol';
/**
* Required contract since CSFeatureRegistry has no add feature function
*/
contract TestRegistry is CSFeatureRegistry {
/// @notice constuctor
constructor (string memory _name, uint _h3Resolution, string memory _s... | Required function to add features/ | function claimFeature (bytes15 dggsIndex,
bytes32 wkbHash)
public addFeature( dggsIndex, wkbHash, msg.sender)
returns (bytes32) {
CSFeature feature = new CSFeature(dggsIndex,wkbHash, msg.sender, h3Resolution);
bytes32 csc = feature.getFeatureCSC();
features[csc] = addre... | 12,622,381 |
./full_match/1/0x92344754a9060a52A634B3c6b8118f76baD1A448/sources/contracts/staking/LeverageStake.sol | Withdraws an `amount` of underlying asset from the reserve, burning the equivalent aTokens owned amount The underlying amount to be withdrawn | function withdraw(uint256 amount) internal {
_checkTx();
etf.invokeWithdraw(lendingPool, address(stETH), amount);
}
| 2,998,060 |
// SPDX-License-Identifier: BSD-3-Clause
pragma solidity ^0.8.13;
/// @title The Nouns DAO logic version 1
/*********************************
* ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ *
* ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ *
* ░░░░░░█████████░░█████████░░░ *
* ░░░░░░██░░░████░░██░░░████░░░ *
* ░░██████░░░████████░░░████░░░ *
... | Internal function that caries out voting logic voter The voter that is casting their vote proposalId The id of the proposal to vote on support The support value for the vote. 0=against, 1=for, 2=abstain return The number of votes cast/ : Unlike GovernerBravo, votes are considered from the block the proposal was crea... | function castVoteInternal(
address voter,
uint256 proposalId,
uint8 support
) internal returns (uint96) {
require(
state(proposalId) == ProposalState.Active,
"NounsDAO::castVoteInternal: voting is closed"
);
require(support <= 2, "NounsDAO::castVoteInternal: invalid vote type");
... | 12,735,786 |
// SPDX-License-Identifier: MIT
// Sources flattened with hardhat v2.3.0 https://hardhat.org
// File @openzeppelin/contracts/token/ERC20/IERC20.sol@v4.1.0
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tok... | we don't check `newTaxTo` is address(0) | function setTaxTo(address newTaxTo) public onlyOwner {
taxTo = newTaxTo;
emit NewTaxTo(newTaxTo);
}
| 1,646,166 |
/**
*Submitted for verification at Etherscan.io on 2021-03-14
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
*... | Get operation hash for multisig operation Nonce used to ensure that signature used only once. Use unique typehash for each operation./ | function getOperationHash(bytes32 typehash, address target, uint256 value) public view returns (bytes32) {
return keccak256(abi.encodePacked(address(this), typehash, target, value, nonce));
}
| 7,986,800 |
./full_match/1/0x07b0bE8512417a8599a37DC74862Ccb79d2f1400/sources/contracts/TokenStaker.sol | Storage of set values Position of the value in the `values` array, plus 1 because index 0 means a value is not in the set. | function _beforeTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
function _afterTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
}
struct Set {
bytes32[] _values;
... | 8,456,734 |
// File: contracts/Owned.sol
pragma solidity 0.6.7;
contract Owned {
address public owner = msg.sender;
event LogOwnershipTransferred(address indexed owner, address indexed newOwner);
modifier onlyOwner {
require(msg.sender == owner, "Sender must be owner");
_;
}
function setOwner(address _owner... | Returns the address that signed a hashed message (`hash`) with `signature`. This address can then be used for verification purposes. The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: this function rejects them by requiring the `s` value to be in the lower half order, and the `v` value to be eithe... | function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
if (signature.length != 65) {
revert("ECDSA: invalid signature length");
}
bytes32 s;
uint8 v;
assembly {
r := mload(add(signature, 0x20))
s := mload... | 1,986,048 |
/**
*Submitted for verification at Etherscan.io on 2020-11-17
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
... | Set reward period/ | function setRewardPeriod(uint256 rewardPeriod) external onlyOwner returns (bool) {
require(rewardPeriod >= _minRewardPeriod, 'reward period should be above min reward period.');
_rewardPeriod = rewardPeriod;
return true;
}
| 2,093,056 |
./partial_match/42/0x85B362211394C55bef04AE6cCC3F61971B91F053/sources/FarmProRata.sol | uint lastTurboUpdate var globale | function turboUpdate() private onlyOwner {
uint timeDiff;
uint _now = now;
uint rewardsAmount;
uint amountperLp = rewardsAmount.mul(pointMultiplier).div(totalTokens);
totalDivPoints = totalDivPoints.add(amountperLp);
lastTurboUpdate = now;
}
| 8,945,497 |
pragma solidity ^0.4.11;
contract SimpleAuction {
// Parameters of the auction. Times are either
// absolute unix timestamps (seconds since 1970-01-01)
// or time periods in seconds.
address public beneficiary;
uint public auctionStart;
uint public biddingTime;
// Current state of the auct... | Create a simple auction with `_biddingTime` seconds bidding time on behalf of the beneficiary address `_beneficiary`. | function SimpleAuction() {
beneficiary = 0x7Ef6fA8683491521223Af5A69b923E771fF2e73A;
auctionStart = now;
biddingTime = 7 days;
}
| 15,077,740 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./ERC20Snapshot.sol";
contract Myobu is ERC20Snapshot {
address public override DAO; // solhint-disable-line
address public override myobuSwap;
bool private antiLiqBot;
constructor(address payable addr1) MyobuBase(addr1) {
setFe... | Creates a new snapshot and returns its snapshot id. Emits a {Snapshot} event that contains the same id. {_snapshot} is `internal` and you have to decide how to expose it externally. Its usage may be restricted to a set of accounts, for example using {AccessControl}, or it may be open to the public. [WARNING] ==== While... | function _snapshot() internal virtual returns (uint256) {
_currentSnapshotId.increment();
uint256 currentId = getCurrentSnapshotId();
emit Snapshot(currentId);
return currentId;
}
| 9,932,061 |
pragma solidity 0.4.20;
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev In... | Set KYC status as failed. Refund any eth back to address | function revokeKYC(address _kycAddress) onlyOwner external {
require(_kycAddress != address(0));
addressKYC[_kycAddress] = false;
uint256 weiAmount = investedSum[_kycAddress];
totalApprovedAmount = totalApprovedAmount.sub(weiAmount);
if (weiAmount > 0) {
_refund(_kycAddress);
}
}
| 5,343,236 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.1;
import "./ERC721A.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
contract LCC is ERC721A, Ownable {
// Constants
uint256 public constant MAX_SUPPLY = 10_000;
// Variables
uint256 public MINT_PRICE = 0.07 ether;
mapping(addr... | Sets the mint trannche. 1 to 10 | function setTranche(uint _tranche) public onlyOwner {
require(_tranche <=10, "tranche should be < 10");
TRANCHE = _tranche;
}
| 13,962,259 |
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.6;
import {
IERC165,
ERC721,
IERC721,
IERC721Receiver,
Strings
} from "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {ReentrancyGuard} from "@openz... | eventual compatibility with royalties | function royaltyInfo(uint256 /*tokenId*/, uint256 _salePrice)
external view virtual override
returns (address receiver, uint256 royaltyAmount) {
receiver = Settings(settings).royaltyReceiver();
royaltyAmount = _salePrice * Settings(settings).royaltyPercentBips() / 10000;
... | 14,948,777 |
./full_match/137/0x7130678c156f525bdF23322Be09fA85301AcE1A0/sources/contracts/B4REAL.sol | Adds a wallet address from the whitelist | function includeInFee(address wallet)
public
onlyAdmin
onlyValidAddress(wallet)
{
whitelist[wallet] = true;
}
| 4,686,594 |
./partial_match/1/0xa3df9428dedA5120d04177488849f7507B2e5067/sources/SmartController.sol | Transfers tokens from a specific address [ERC20]. The address owner has to approve the spender beforehand. The from address, to address and amount are validated before executing method. Overrides method in a parent. Prior to transfering tokens the validator needs to approve. caller Address of the caller passed throug... | function transferFrom_withCaller(
address caller,
address from,
address to,
uint256 amount
) public override returns (bool) {
require(
smartToken.validate(from, to, amount),
"transferFrom request not valid"
);
return super.transferF... | 4,150,095 |
./full_match/43114/0xc9070B3EFE0aacC5AfB4B31C5DbDCA7C6B4bAAA9/sources/contracts/YieldWolf.sol | runs the strategy and pays the bounty reward _pid the pool id/ | function earn(uint256 _pid) external nonReentrant returns (uint256) {
return _earn(_pid);
}
| 4,507,341 |
/**
*Submitted for verification at Etherscan.io on 2021-09-09
*/
pragma solidity ^0.5.16;
interface IERC20 {
function totalSupply() external view returns (uint);
function balanceOf(address account) external view returns (uint);
function transfer(address recipient, uint amount) external returns (bool);
... | Solidity only automatically asserts when dividing by 0 | function div(uint a, uint b, string memory errorMessage) internal pure returns (uint) {
require(b > 0, errorMessage);
uint c = a / b;
return c;
}
| 15,036,347 |
pragma solidity ^0.5.0;
contract Auction {
// the owner of the auction
address payable public owner;
// the start time of the auction
uint256 public startTime;
// the end time of the auction
uint256 public endTime;
// the current highest bid/bidder
uint256 public highestBid;
addres... | you can withdraw if you are not owner if you are the current highest bidder, you can not withdraw your highest bid (only the other ones) if the transaction fails, the amount is added back | function withdraw() public payable notOwner returns (bool) {
uint256 amount = amounts[msg.sender];
if (amount > 0) {
amounts[msg.sender] = 0;
if (!msg.sender.send(amount)) {
amounts[msg.sender] = amount;
return false;
}
}
... | 999,975 |
// SPDX-License-Identifier: MIT
// TODO: What license do we release under?
pragma solidity >=0.6.0 <0.8.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
/**
@title Fountain
Create a MoneyPool (... | A message sender can collect what's been redistributed to it by MoneyPools once they have expired. amount The amount to collect. return success If the collecting was a success. Iterate over all of sender's sustained addresses to make sure redistribution has completed for all redistributable MoneyPools | function collectRedistributions(uint256 amount)
external
returns (bool success)
{
address[] storage sustainedAddresses = sustainedAddressesBySustainer[msg
.sender];
for (uint256 i = 0; i < sustainedAddresses.length; i++) {
_redistributeMoneyPool(sustainedA... | 13,081,311 |
pragma solidity 0.4.24;
import { SafeMath } from "openzeppelin-solidity/contracts/math/SafeMath.sol";
import { BasicToken } from "openzeppelin-solidity/contracts/token/ERC20/BasicToken.sol";
import { Ownable } from "openzeppelin-solidity/contracts/ownership/Ownable.sol";
/**
* @title A token that can increase its s... | Forbid specified address to mint tokens addr address The denied Minting Manager address/ | function revokeMintingManager(address addr)
public
onlyOwner
onlyMintingManager(addr)
onlyMintingNotFinished
{
delete isMintingManager[addr];
emit MintingManagerRevoked(addr);
}
| 955,909 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.10;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "./ERC721.sol";
/**
* @title MasterchefMasatoshi
* NFT + DAO = NEW META
... | 2.5% Omakasea Fee 2.5% Omakasea Fee | function mintPublic(uint amount) public payable {
require(mintStatus == MintStatus.Public && !paused, "s");
require(totalSupply() + amount <= maxPossibleSupply, "m");
require(totalMintsPerAddress[msg.sender] + amount <= maxAllowedMints, "l");
uint mintAmount = mintPrice * amount;
uint omakaseaFee... | 409,979 |
/**
*Submitted for verification at Etherscan.io on 2020-10-26
*/
// File: contracts/lib/interface/ICelerWallet.sol
pragma solidity ^0.5.1;
/**
* @title CelerWallet interface
*/
interface ICelerWallet {
function create(address[] calldata _owners, address _operator, bytes32 _nonce) external returns(bytes32);
... | inject PUBLIC FUNC TO EXTERNAL | function getMigratedTo(LedgerStruct.Channel storage _c) public view returns(address) { | 5,426,848 |
pragma solidity 0.6.12;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "./interfaces/IMintableCollection.sol";
import "./interfaces/IRewardable.sol";
import "./abstract/EmergencyWithdrawable... | lets burn the NFT first reset the pool props reset all staker props | function withdraw(uint256 nftId) external {
StakerInfo storage staker = stakes[nftId];
require(address(staker.rewardToken) != address(0), "UnicStaking: No staker exists");
require(
nftCollection.ownerOf(nftId) == msg.sender,
"UnicStaking: Only the owner may withdraw"
... | 13,132,040 |
pragma solidity ^0.8.0;
// SPDX-License-Identifier: MIT
import "./interfaces/IManaging.sol";
import "../core/DaoConstants.sol";
import "../core/DaoRegistry.sol";
import "../adapters/interfaces/IVoting.sol";
import "../guards/MemberGuard.sol";
/**
MIT License
Copyright (c) 2020 Openlaw
Permission is hereby granted,... | Processes a proposal that was sponsored. Only members can process a proposal. Only if the voting pass the proposal is processed. Reverts when the adapter address is already in use and it is an adapter addition. dao The dao address. proposalId The guild kick proposal id./ | function processProposal(DaoRegistry dao, bytes32 proposalId)
external
override
{
ProposalDetails memory proposal = proposals[address(dao)][proposalId];
IVoting votingContract = IVoting(dao.votingAdapter(proposalId));
require(address(votingContract) != address(0), "adapt... | 5,431,873 |
./partial_match/4/0xed9287ca282Cf581a237e95ADFcfB7E49Bd8ED57/sources/auto_pool.sol | user should hold 2500 tokens for qualify for loyalty bonus; return loyalty bonus users | function loyaltyOf() public view returns(uint256){
address _customerAddress = msg.sender;
if(tokenBalanceLedger_[_customerAddress] >= 2000*10**uint256(decimals)){
}
else{
return 0;
}
}
| 16,971,197 |
./partial_match/1/0x9a5132e149c547F254C73226DA7f770d43D9EA44/sources/contracts/periphery/libraries/Path.sol | Skips a token from the buffer and returns the remainder path The swap path return The remaining token elements in the path | function skipToken(bytes memory path) internal pure returns (bytes memory) {
return path.slice(NEXT_OFFSET, path.length - NEXT_OFFSET);
}
| 2,733,422 |
//SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.4;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
contract SmartChefMarket is Ownable {
using SafeERC20 for IERC20;
uint ... | Withdraw reward token. EMERGENCY ONLY. | function emergencyRewardTokenWithdraw(address _token, uint256 _amount) public onlyOwner {
require(IERC20(_token).balanceOf(address(this)) >= _amount, "Not enough balance");
IERC20(_token).safeTransfer(msg.sender, _amount);
}
| 13,016,438 |
pragma solidity ^0.5.0;
//Functionality list
//create posts
//list posts
//tip author posts with crypto
//create new contract / class
contract SocialNetwork {
//variables
string public name;
uint public postCount = 0;
//keep track of unique Posts
mapping(uint => Post) public posts;
... | Post functionset required checkconnvert _content to bytes array and get its lengthicrement post countinstantiate Post and add to mapping to write to blockchainposts is a key value pair, with postCount value === keytrigger event (same values as createPost function that's being tested) | function createPost(string memory _content) public {
require(bytes(_content).length > 0);
postCount ++;
posts[postCount] = Post(postCount, _content, 0, msg.sender);
emit PostCreated(postCount, _content, 0, msg.sender);
}
| 15,850,509 |
//SPDX-License-Identifier: Unlicense
pragma solidity 0.7.0;
import "./interfaces/IBank.sol";
import "./interfaces/IPriceOracle.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "./libraries/Math.sol";
import "hardhat/console.sol";
contract Bank is IBank {
IPriceOracle oracle;
address privat... | TODO: check for negative or 0 | function deposit(address token, uint256 amount)
external
payable
override
OnlyIfValidToken(token)
updateInterest(token)
returns (bool)
{
if (token == magic_token) {
accounts[msg.sender].eth_act.deposit =
accounts[msg.sender].eth... | 15,798,812 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.