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.0;
// Interfaces
import { IsaLPPricer } from "../IsaLPPricer.sol";
import {
PrizePoolInterface
} from "../../shared/interfaces/pooltogether/PrizePoolInterface.sol";
import {
IControlledToken
} from "../../shared/interfaces/pooltogether/IControlledToken.sol";... | TODO: not currently being used It calculates the value of the protocol token amount into the underlying asset. The value of an Aave token is always the same as the underlying asset amount. See {AavePricer.getRateFor} saLPToken address of the single asset liquidity provider token amount Amount of the token to conver... | function getValueOf(address saLPToken, uint256 amount)
external
view
override
returns (uint256)
{
return 0;
}
| 13,106,817 |
./full_match/1/0x60232134f0A9177e5248BC44fC95c2c5EFEf8E1A/sources/src/experimental/delegate-bid.sol | Casts a vote on an external proposal. Tip is awarded to the caller dao The address of the DAO propId The id of the proposal to execute This function ensures that the proposal is within the execution window and that some bid has been offered to cast the vote/ refund gas and calculate an incentive for the executer, di... | function castExternalVote(address dao, uint256 propId) external nonReentrant {
uint256 startGas = gasleft();
require(dao != address(0), "DAO address is not valid");
require(_isActive(dao, propId), "Voting is closed for this proposal");
Bid storage bid = bids[address(dao)][propId];
... | 17,035,288 |
./partial_match/1/0x457cD63bee88ac01f3cD4a67D5DCc921D8C0D573/sources/contracts/abstract/JBPayoutRedemptionPaymentTerminal3_1_1.sol | Get the fee discount from the fee gauge for the specified project. _projectId The ID of the project to get a fee discount for. _feeType The type of fee the discount is being applied to. return feeDiscount The fee discount, which should be interpreted as a percentage out MAX_FEE_DISCOUNT. Can't take a fee if the proto... | ) internal view returns (uint256) {
if (
directory.primaryTerminalOf(_FEE_BENEFICIARY_PROJECT_ID, token) ==
IJBPaymentTerminal(address(0))
) return JBConstants.MAX_FEE_DISCOUNT;
if (feeGauge != address(0))
try IJBFeeGauge3_1(feeGauge).currentDiscountFor(_projectId, _feeType) returns (
... | 4,264,599 |
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/access/Ownable.sol";
import '@openzeppelin/contracts/utils/math/SafeMath.sol';
import '@openzeppelin/contracts/interfaces/IERC721.sol';
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "./AnonymiceLibrary.sol";
import "./Origi... | Hash to metadata function/ | function hashToMetadata(string memory _hash, uint _tokenId)
public
view
returns (string memory)
{
string memory metadataString;
OriginalAnonymiceInterface originalMiceCollection = OriginalAnonymiceInterface(anonymiceContract);
for (uint8 i = 0; i < 9; i++) {
uint... | 14,342,348 |
./partial_match/80001/0xbFABf2373eEFf171E4462819ba5E51e1F842e51c/sources/@cryptoalgebra/plugins/contracts/interfaces/IAlgebraVirtualPool.sol | The interface for the virtual pool Used to calculate active liquidity in farmings | interface IAlgebraVirtualPool {
function crossTo(int24 targetTick, bool zeroToOne) external returns (bool success);
pragma solidity >=0.5.0;
}
| 8,815,121 |
pragma solidity ^0.5.0;
library MerkleTreeVerifier {
function math_log2(
uint x
)
public
pure
returns (uint y)
{
assembly {
let arg := x
x := sub(x,1)
x := or(x, div(x, 0x02))
x := or(x, div(x, 0x04))
x :... | extend layer to be a power of 2 this simplifies logic later Hash leaves | function _computeMerkleRoot(
bytes32[] memory items
)
public
pure
returns (bytes32)
{
bytes32[] memory layer = _getBalancedLayer(items);
for(uint i = 0; i < layer.length; i++) {
layer[i] = _hashLeaf(layer[i]);
}
while(layer.le... | 12,921,503 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IERC20.sol";
import "./Ownable.sol";
import "./SafeMath.sol";
import "./Address.sol";
interface ISwapAndLiquify{
function inSwapAndLiquify() external returns(bool);
function swapAndLiquify(uint256 tokenAmount) external;
}
contract ALDN is IER... | Gets the votes balance of `checkpoint` with `rate` checkpoint The checkpoint to get votes balance rate The rate to get votes balance return The number of votes of `checkpoint` with `rate`/ | function _getVotes(VotesCheckpoint memory checkpoint, uint256 rate) private pure returns (uint96) {
return _getVotes(checkpoint.rOwned, checkpoint.tOwned, rate);
}
| 1,414,418 |
./full_match/1/0x418a29D6697dcfc1FB6faD99760639164cf2092B/sources/contracts/adapters/AuctionRebalanceExtension.sol | OPERATOR ONLY: Checks that the old components array matches the current components array and then invokes the AuctionRebalanceModuleV1 startRebalance function. Refer to AuctionRebalanceModuleV1 for function specific restrictions. _quoteAsset ERC20 token used as the quote asset in auctions. _oldCompo... | function startRebalance(
IERC20 _quoteAsset,
address[] memory _oldComponents,
address[] memory _newComponents,
AuctionExecutionParams[] memory _newComponentsAuctionParams,
AuctionExecutionParams[] memory _oldComponentsAuctionParams,
bool _shouldLockSetToken,
u... | 4,894,984 |
./full_match/42/0x6D2991198C8688261364BBC1F1740a359eBfc761/sources/browser/WETHParty.sol | set member shares and loot to burn shares and loot (obviously sets member shares and loot back to 0) | function _ragequit(address memberAddress) internal returns (uint256) {
uint256 initialTotalSharesAndLoot = totalShares.add(totalLoot);
Member storage member = members[memberAddress];
require(canRagequit(member.highestIndexYesVote), "cannot ragequit until highest index proposal member voted... | 9,582,682 |
./full_match/1/0xb84cecd3e0708C3e38E63Ac001E2a4D892c33a57/sources/meTokens.sol | Transfer `amount` tokens from `msg.sender` to `dst` dst The address of the destination account rawAmount The number of tokens to transfer return Whether or not the transfer succeeded/ | function transfer(address dst, uint rawAmount) external returns (bool) {
uint96 amount = safe96(rawAmount, "ME::transfer: amount exceeds 96 bits");
_transferTokens(msg.sender, dst, amount);
return true;
}
| 3,048,370 |
pragma solidity 0.6.12;
interface IAdmin {
function isAdmin(address user) external view returns (bool);
}
// File @openzeppelin/contracts/token/ERC20/IERC20.sol@v3.4.1
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the am... | Compute round Id Push id to array of ids Create round Map round id to round Fire event | function setRounds(
uint256[] calldata startTimes,
uint256[] calldata maxParticipations
) external onlyAdmin {
require(sale.isCreated);
require(
startTimes.length == maxParticipations.length,
"setRounds: Bad input."
);
require(roundIds.leng... | 12,826,352 |
./full_match/1/0xcEAb38B5C88F33Dabe4D31BDD384E08215526632/sources/browser/CompoundSaverFlashProxy.sol | Internal method that preforms a sell on 0x/on-chain Usefull for other DFS contract to integrate for exchanging exData Exchange data struct return (address, uint) Address of the wrapper used and destAmount if selling eth, convert to weth Try 0x first and then fallback on specific wrapper fallback to desired wrapper if... | function _sell(ExchangeData memory exData) internal returns (address, uint) {
address wrapper;
uint swapedTokens;
bool success;
uint tokensLeft = exData.srcAmount;
if (exData.srcAddr == KYBER_ETH_ADDRESS) {
exData.srcAddr = ethToWethAddr(exData.srcAddr);
... | 3,169,906 |
./full_match/1/0x6307be80ABACAEc6305a2b353EeCa338Ba469d39/sources/contracts/QuiddMintables.sol | @inheritdoc ERC165/ | function supportsInterface(bytes4 interfaceId)
public
view
virtual
override(QuiddMintablesBase, ERC2981TokenIDMask, AccessControl)
returns (bool)
{
return QuiddMintablesBase.supportsInterface(interfaceId) ||
ERC2981TokenIDMask.supportsInterface(interfaceId) ||
AccessControl... | 9,798,064 |
./full_match/5/0x2ACde37ab4FFF420eF8C277984E5f869C32B76e4/sources/contracts/Contract.sol | Allows a voter to login using their department and matriculation number. _department The department of the voter. _matriculationNumber The matriculation number of the voter./ | function loginVoter(string memory _department, string memory _matriculationNumber) public {
require(bytes(_department).length > 0, "Invalid department name");
require(isValidMatriculationNumber(_department, _matriculationNumber), "Invalid matriculation number");
voters[msg.sender] = Voter(f... | 7,063,426 |
pragma solidity ^0.4.24;
/**
* @title ERC721 Non-Fungible Token Standard Basic Interface
* @dev Based on openzepplin open source ERC721 examples.
* See (https://github.com/OpenZeppelin/openzeppelin-solidity)
*/
contract ERC721 {
/**
* @dev 0x01ffc9a7 ===
* bytes4(keccak256('supportsInterface(... | Enumerate PixelCon in collection `(_collectionIndex)` Throws if the collection does not exist or index is out of bounds _collectionIndex Collection index _index Counter less than `collectionTotal(_collection)` return PixelCon ID for the `(_index)`th PixelCon in collection `(_collectionIndex)`/ | function tokenOfCollectionByIndex(uint64 _collectionIndex, uint256 _index) public view validIndex(_collectionIndex) returns(uint256)
{
require(_collectionIndex < totalCollections(), "Collection does not exist");
require(_index < collectionTokens[_collectionIndex].length, "Index is out of bounds");
PixelCon stor... | 1,804,972 |
pragma solidity ^0.4.18;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
/**
* @dev The Ownable constructor set... | get names for specified tokens _tokenIds uint256[] array of ids for whom descriptons will be returnedreturn descriptonData bytes32return descriptionLength number of bytes32 in token name, sum of nameLength values equals namesData.length (1 to 1 with _tokenIds) | function getTokenDescriptions(address _tokenInterface, uint256[] _tokenIds) external view returns(bytes32[] memory descriptonData, uint256[] memory descriptionLength) {
return _getTokenTexts(_tokenInterface, _tokenIds, false);
}
| 2,569,560 |
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.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 ret... | 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,
uint nonce,
uint expiry,
uint8 v,
bytes32 r,
bytes32 s
)
external
{
bytes32 domainSeparator = keccak256(
abi.encode(
DOMAIN_TYPEHASH,
keccak256(bytes(name())... | 11,704,744 |
./partial_match/1/0xe91125f34fcEF2854A890DCf02b74Cb2DcbE377f/sources/SpaceToken.sol | Creates a new promo Person with the given name, with given _price and assignes it to an address. | function createPromoPerson(address _owner, string _name, uint256 _price) public onlyCOO {
require(promoCreatedCount < PROMO_CREATION_LIMIT);
address personOwner = _owner;
if (personOwner == address(0)) {
personOwner = cooAddress;
}
if (_price <= 0) {
_price = startingPrice;
}
... | 2,592,399 |
pragma solidity ^0.5.0;
/**
* @title SafeMath
* @dev Unsigned math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two unsigned integers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimiz... | Get balance on hold of a tokenholder./ | function balanceOnHold(address token, address account) external view returns (uint256) {
return _heldBalance[token][account];
}
| 1,722,092 |
/**
* MIT License
*
* Copyright (c) 2019 eToroX Labs
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, mod... | Internal function that burns an amount of the token of a given account, deducting from the sender's allowance for said account. Uses the internal burn function. originSender the original transaction sender account The account whose tokens will be burnt. value The amount that will be burnt./ | function _burnFrom(address originSender, address account, uint256 value)
internal
returns (bool)
{
require(value <= externalStorage.getAllowed(account, originSender));
externalStorage.decreaseAllowed(account, originSender, value);
_burn(account, value);
emit App... | 12,899,639 |
./partial_match/56/0x79Ed648f0Fb424Ec37897DF87B9ee80cca65B230/sources/ProofOfApes.sol | Retrieve the dividends owned by the caller. If `_includeReferralBonus` is to to 1/true, the referral bonus will be included in the calculations. The reason for this, is that in the frontend, we will want to get the total divs (global + ref) But in the internal calculations, we want them separate./ | function myDividends(bool _includeReferralBonus) public view returns (uint256) {
address _customerAddress = msg.sender;
return
_includeReferralBonus
? dividendsOf(_customerAddress) + referralBalance_[_customerAddress]
: dividendsOf(_customerAddress);
}
| 11,213,885 |
/**
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity 0.8.9;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this; // silence state mutability war... | exclude from paying fees or having max transaction amount | constructor() ERC20("Rhapsody", "Rhapsody") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(... | 10,217,794 |
// contracts/Crowns.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.6.7;
import "./../openzeppelin/contracts/access/Ownable.sol";
import "./../openzeppelin/contracts/GSN/Context.sol";
import "./../openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./../openzeppelin/contracts/math/SafeMath.sol";
import "./..... | Return amount of tokens that {account} gets during the PayWave Used both internally and externally to calculate the PayWave amount account is an address of token holder to calculate for return amount of tokens that player could get/ The PayWave is not a part of total supply, since it was moved out of balances PayWave... | function payWaveOwing (address account) public view returns(uint256) {
Account memory _account = _accounts[account];
uint256 newPayWave = totalPayWave.sub(_account.lastPayWave);
uint256 proportion = _account.balance.mul(newPayWave);
uint256 supply = _totalSupply.sub(newPayWave);
... | 14,086,719 |
/**
*Submitted for verification at Etherscan.io on 2021-09-30
*/
// SPDX-License-Identifier: AGPLv3
pragma solidity 0.8.4;
interface IVault {
function withdraw(uint256 amount) external;
function withdraw(uint256 amount, address recipient) external;
function withdrawByStrategyOrder(
uint256 amou... | Perform any Strategy unwinding or other calls necessary to capture the "free return" this Strategy has generated since the last time its core position(s) were adjusted. Examples include unwrapping extra rewards. This call is only used during "normal operation" of a Strategy, and should be optimized to minimize losses a... | function prepareReturn(uint256 _debtOutstanding)
internal
virtual
returns (
uint256 _profit,
uint256 _loss,
uint256 _debtPayment
);
function adjustPosition(uint256 _debtOutstanding) internal virtual;
function liquidatePosition(uint256 _am... | 6,580,014 |
./partial_match/1/0xdb3D91Dcb27547d82A09556D1028beEdB04A5902/sources/src/Asset/ERC1155ERC721.sol | NOTE: call data should be optimized to order _ids so packedBalance can be used efficiently Last bin updated | function _batchTransferFrom(address _from, address _to, uint256[] memory _ids, uint256[] memory _values) internal {
require(_ids.length == _values.length, "Inconsistent array length between args");
require(_to != address(0), "Invalid recipient");
bool authorized = mSuperOperators[msg.sender]... | 9,405,670 |
./full_match/42/0x9a02B92718844E2D285FC278529653D499d29827/sources/Users/apple/Documents/yai-protocol-private/contracts/strategies/yearnStrategy/yearnTestnet.sol | Withdraw partial funds, normally used with a vault withdrawal | function withdraw(uint256 _amount) external isAuthorized {
emit Withdraw();
rebalance();
uint256 _balance = IERC20(want).balanceOf(address(this));
if (_balance < _amount) {
_amount = _withdrawSome(_amount.sub(_balance));
_amount = _amount.add(_balance);
... | 16,295,345 |
./full_match/100/0x697240b2124bEd2B19FB003Ec4e4cFb5b125B0D1/sources/deploy/contracts/tokens/MintableBurnableSyntheticToken.sol | Accessor method for the list of member with burner role return array of address with burner role/ | function getBurnerMembers() external view returns (address[] memory) {
uint256 numberOfMembers = getRoleMemberCount(BURNER_ROLE);
address[] memory members = new address[](numberOfMembers);
for (uint256 j = 0; j < numberOfMembers; j++) {
address newMember = getRoleMember(BURNER_ROLE, j);
member... | 14,267,079 |
./partial_match/1/0x208BCf9CD1D694D1D3C630362E517940e3724D80/sources/Oracle.sol | This will set the number of transactions required before the 'swapAndLiquify' function triggers | function set_Number_Of_Transactions_Before_Liquify_Trigger(uint8 number_of_transactions) public onlyOwner {
swapTrigger = number_of_transactions;
}
bool public noFeeToTransfer = true;
| 15,961,570 |
./partial_match/1/0xdefac16715671b7b6aeeFE012125f1E19Ee4b7d7/sources/PrimeDeployable.sol | Skip the original init function | function init(address) internal override {
}
| 2,630,767 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <=0.8.7;
//import "hardhat/console.sol";
import "prb-math/contracts/PRBMathUD60x18.sol";
// describes the logic of taxes
contract TaxContract {
using PRBMathUD60x18 for uint256;
event OnReward(address indexed account, uint256 value); // who and how muc... | returns the time when the specified account received the tax or 0 if it did not receive the tax | function GetLastRewardTime(address account) public view returns (uint256) {
return _taxGettings[account];
}
| 6,362,673 |
pragma solidity ^0.4.18;
contract Token {
// owner -> amount
mapping(address => uint256) balances;
// owner -> spender -> max amount
mapping(address => mapping(address => uint256)) allowances;
uint256 supply;
uint256 constant LOG0 = 0;
uint256 constant LOG1 = 1;
uint256 constant L... | Spec: Allow _spender to withdraw from your account, multiple times, up to the _value amount. If this function is called again it overwrites the current allowance with _value. | function approve(address _sender, uint256 _msg_value, address _spender, uint256 _value) public returns (uint256[7] success) {
if (_msg_value != 0) {
return ([uint256(0), 0, 0, 0, 0, 0, 0]);
}
address _owner = _sender;
allowances[_owner][_spender] = _value;
return... | 12,759,157 |
/**
*Submitted for verification at Etherscan.io on 2021-04-10
*/
// SPDX-License-Identifier: MIT
pragma solidity =0.7.6;
pragma experimental ABIEncoderV2;
abstract contract IGem {
function dec() virtual public returns (uint);
function gem() virtual public returns (IGem);
function join(address, uint)... | Opens up an empty vault _joinAddr Join address of the maker collateral _mcdManager The manager address we are using | function _mcdOpen(address _joinAddr, address _mcdManager) internal returns (uint256 vaultId) {
bytes32 ilk = IJoin(_joinAddr).ilk();
vaultId = IManager(_mcdManager).open(ilk, address(this));
logger.Log(
address(this),
msg.sender,
"McdOpen",
ab... | 2,285,153 |
pragma solidity >=0.4.25 <0.6.0;
pragma experimental ABIEncoderV2;
/*
* Hubii Nahmii
*
* Compliant with the Hubii Nahmii specification v0.12.
*
* Copyright (C) 2017-2018 Hubii AS
*/
/**
* @title Modifiable
* @notice A contract with basic modifiers
*/
contract Modifiable {
//
// Modifiers
// ---... | Require positive amount Clamp amount to stage | function _subtractFungibleSequentially(address wallet, bytes32[] memory balanceTypes, int256 amount, address currencyCt, uint256 currencyId)
private
returns (int256)
{
require(0 <= amount);
uint256 i;
int256 totalBalanceAmount = 0;
for (i = 0; i < balanceTypes.length; i+... | 14,081,012 |
/**
*Submitted for verification at Etherscan.io on 2021-02-06
*/
// SPDX-License-Identifier: GPL
pragma solidity 0.6.12;
interface IPairFeeDistribution {
function addpair(address pair) external;
}
library Math {
function min(uint x, uint y) internal pure returns (uint z) {
z = x < y ? x : y;
}
... | Current order tries to deal against the AMM pool. Returns whether current order fully deals. all the below variables are less than 112 bits | function _tryDealInPool(Context memory ctx, bool isBuy, RatPrice memory price) private pure returns (bool) {
uint currTokenCanTrade = _intopoolAmountTillPrice(isBuy, ctx.reserveMoney, ctx.reserveStock, price);
require(currTokenCanTrade < uint(1<<112), "GraSwap: CURR_TOKEN_TOO_LARGE");
if(!is... | 2,413,367 |
./partial_match/1/0x3061579E7dF4e618D9b657ccdE6c52Fb4ca0d439/sources/contracts/UncleBondFees.sol | / Favoring push over pull to reduce accounting complexity for different tokens | function distributeFees(
address from,
address token,
uint256 amount
) external {
emit DistributeFees(token, amount);
ERC20 t = ERC20(token);
uint256 treasuryDistribution = (amount * treasuryPercent) /
PERCENT_DENOMINATOR;
t.safeTransferFrom(... | 9,187,429 |
./full_match/1/0x673003F86fFe32F7CaA3E5fcfDC711EBf8A64aeF/sources/src/lib/module/ModuleFee.sol | Function to set a new FeeManager newFeeManager The new FeeManager address to write to storage | function setNewFeeManager(address newFeeManager) external onlyOwner {
require(newFeeManager != address(0) && newFeeManager != feeManager, "INVALID_FEE_MANAGER");
emit FeeManagerUpdated(feeManager, newFeeManager);
feeManager = newFeeManager;
}
==============*/
| 3,159,277 |
./full_match/43113/0x617b2E3c10325C546533Ecae277bcf9964aB3373/sources/KANDYSale.sol | claim KANDY allocation based on old + new invested amounts | function claimKANDY() public onlyEOA {
require(canClaim, "cannot claim yet");
require(!claimed[msg.sender], "already claimed");
require(!blacklisted[msg.sender], "blacklisted");
if ( invested[msg.sender] > 0 ) {
ERC20(KANDY).transfer(msg.sender, invested[msg.sender]);
... | 7,129,929 |
./partial_match/1/0x9678b0CE0059d5e2E46453656B7f58ABfD129846/sources/STIMULUS_FINANCE_Dispatcher.sol | bytes4(keccak256(bytes('transferFrom(address,address,uint256)'))); | function safeTransferFrom(address token, address from, address to, uint value) internal {
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FROM... | 2,766,565 |
./full_match/137/0x33A4DC7FA425eD0a4BBbc20E3180442CCD855e86/sources/contracts/PolyDice.sol | Function to get the Balance of the Contract | function getBalance() public view returns (uint) {
return ContractBalance;
}
| 4,731,575 |
/** Copyright (c) 2018, ZSC Dev Team
* 2018-10-19: v0.00.01
*/
pragma solidity ^0.4.25;
// pragma experimental ABIEncoderV2;
import "../utillib/LibString.sol";
import "../utillib/LibInt.sol";
import "../common/pausable.sol";
import "../common/delegate.sol";
contract InsuranceCompany {
// function update(stri... | Check that if user exist _type uint8 The info type (0: key is string, 1: key is address). _key0 string The key of user for string. _key1 address The key of user for address. return true/false./ | function userExist(uint8 _type, string _key0, address _key1) external view whenNotPaused _onlyReaderOrHigher _checkUserAddr returns (bool) {
return InsuranceUser(userAddr_).exist(_type, _key0, _key1);
}
| 1,811,884 |
pragma solidity 0.4.19;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
retur... | Adds new member to book account address Member's address joined uint32 Member's joining timestamp/ | function add(
MembersBook storage self,
address account,
uint32 joined
)
internal
returns (bool)
{
if (account == address(0) || contains(self, account)) {
return false;
}
self.entries.push(
Member({
acco... | 12,721,307 |
./partial_match/1/0xbc6a1af02c09fc1514B95eC98756ccAa95e8Af2e/sources/GEtherBridge.sol | Provides the total amount kept in the reserve in terms of the underlying asset. return _totalReserveUnderlying The underlying asset balance on reserve./ | function totalReserveUnderlying() public view virtual override returns (uint256 _totalReserveUnderlying)
{
return GCFormulae._calcUnderlyingCostFromCost(totalReserve(), exchangeRate());
}
| 2,651,057 |
pragma solidity ^0.5.0;
import "./IDssProxyActions.sol";
contract DssProxyActionsBase {
uint256 constant RAY = 10**27;
// Internal functions
function mul(uint256 x, uint256 y) internal pure returns (uint256 z) {
require(y == 0 || (z = x * y) / y == x, "mul-overflow");
}
function sub(uin... | Gets DAI from the user's wallet Approves adapter to take the DAI amount Joins DAI into the vat | function daiJoin_join(address apt, address urn, uint256 wad) public {
DaiJoinLike(apt).dai().transferFrom(msg.sender, address(this), wad);
DaiJoinLike(apt).dai().approve(apt, wad);
DaiJoinLike(apt).join(urn, wad);
}
| 2,488,304 |
pragma solidity ^0.4.10;
/**
* @title Interface to communicate with ICO token contract
*/
contract IToken {
function balanceOf(address _address) constant returns (uint balance);
function transferFromOwner(address _to, uint256 _value) returns (bool success);
}
/**
* @title Presale token contract
*/
contract To... | Returns balance/token quanity owned by address _address Account address to get balance for return balance value / token quantity/ | function balanceOf(address _address) constant returns (uint balance) {
return balanceFor[_address];
}
| 13,039,003 |
./full_match/4/0x7Fc333985BebFd216Cd820AC121E0715db913218/sources/MooMooCollectible.sol | Exclusive presale minting | function mintPresale(uint256 _amount) public payable {
uint256 supply = totalSupply();
uint256 reservedAmt = presaleReserved[msg.sender];
require(presaleActive, "Presale isn't active");
require(reservedAmt > 0, "No tokens reserved for your address");
require(_amount <= reservedAmt, "Can't mint mor... | 12,399,448 |
./partial_match/1/0x99577D3DD4DE7B31DFd034D465cF725FdCC5271B/sources/AMERICANPEPE.sol | Interface for the optional metadata functions from the ERC20Base standard. _Available since v4.1._/ | interface IERC20MetaBase is IERC20Base {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
}
}
| 3,714,171 |
/**
*Submitted for verification at Etherscan.io on 2021-03-15
*/
/**
*Submitted for verification at Etherscan.io on 2020-12-05
*/
pragma solidity ^0.6.12;
// SPDX-License-Identifier: MIT
contract X2 {
using SafeMath for uint256;
string private _tokenName;
string private _tokenSymbol;
uint8 p... | Approve an address to spend another addresses' tokens./ | function _approve(address owner, address spender, uint256 value) internal {
require(spender != address(0));
require(owner != address(0));
_allowed[owner][spender] = value;
emit Approval(owner, spender, value);
}
| 2,457,446 |
./partial_match/56/0x4bf0b64664c4625cd3f15968A8400165962CB728/sources/BooToken.sol | 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
) external {
bytes32 domainSeparator = keccak256(
abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name())), getChainId(), address(this))
... | 11,075,206 |
./full_match/43114/0x0CE5807e595d4F91A7D745330B63Fc7dfD6D6a57/sources/contracts/MasterChef.sol | Withdraw LP tokens from MasterChef. | function withdraw(uint256 _pid, uint256 _amount) public nonReentrant poolExists(_pid) {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
require(user.amount >= _amount, "withdraw: not good");
updatePool(_pid);
uint256 pending = user.... | 4,532,102 |
./full_match/42220/0xBd44Fd1339C3B5Cd95E88501b1A6AB7e54cf5622/sources/contracts/community/CommunityImplementation.sol | Copy a beneficiary _beneficiaryAddress address of the beneficiary to be copied/ | function _copyBeneficiary(address _beneficiaryAddress) internal {
Beneficiary storage _beneficiary = _beneficiaries[_beneficiaryAddress];
if (_beneficiary.state != BeneficiaryState.NONE) {
return;
}
BeneficiaryState _originalState;
uint256 _originalClaims;
... | 16,317,580 |
./partial_match/1/0x85F66f5Ee2435bDCbE12c115bFd592462ECbDb5c/sources/MakerDaoGateway.sol | Abstracted collateral | function skr() external view returns (IERC20); | 3,900,948 |
./full_match/137/0xB3d7bbEf0D9bF76dd46e3b9227446EfBa9231833/sources/src/main/solidity/DVP.sol | Accept a given trade (+ potentially escrow tokens). index Index of the trade to be accepted./ | function acceptTrade(uint256 index) external payable {
_acceptTrade(index, msg.sender, msg.value);
}
| 4,790,543 |
pragma solidity ^0.4.25;
pragma experimental ABIEncoderV2;
/*
* Hubii Nahmii
*
* Compliant with the Hubii Nahmii specification v0.12.
*
* Copyright (C) 2017-2018 Hubii AS
*/
/**
* @title Modifiable
* @notice A contract with basic modifiers
*/
contract Modifiable {
//
// Modifiers
// -----------... | Get the fraction of benefits that is granted the given beneficiary beneficiary Address of beneficiary return The beneficiary's fraction | function beneficiaryFraction(address beneficiary)
public
view
returns (int256)
{
return _beneficiaryFractionMap[beneficiary];
}
| 948,892 |
./partial_match/56/0x9EBAC281dD91cc48fF58528d4EcAD5c89Ae93751/sources/Comptroller.sol | Return the address of the COMP token return The address of COMP/ | function getCompAddress() public view returns (address) {
return 0x838Ee47AaEB55ECA1F8b799eE7383DCa238e4094;
}
| 11,258,979 |
./full_match/42220/0x2de8673F9039Fe5b8494BD7C87eeD24beBc111AE/sources/contracts/CUSD.sol | reserve0 is usdc, reserve1 is celo | function canOpCelo()
public
view
returns (
uint256,
uint256,
uint256,
bool
)
{
(uint256 reserve0, uint256 reserve1, ) = celoUsdcPair.getReserves();
uint256 celoOutMin = router.getAmountOut(usdcTradeAmount, reserve0, reserve1);
uint256 cusdBack = exchange.getBuyTok... | 16,345,245 |
./full_match/1/0x3488d455D4AFA163C7E813c1e2bc2D6887CCE093/sources/contracts/MidgetVotingContract.sol | Creates a new poll./ | function createPoll(
string memory _description
) external returns (uint256 pollId) {
if (msg.sender != owner()) {
require(
token.balanceOf(msg.sender) >= minTokenBalanceToCreatePoll,
"Insufficient token balance."
);
require(
... | 16,451,835 |
./partial_match/4/0x64fD3aea4Df3b76348a8cC9F2A18930fD6927738/sources/RAYv2.sol | could pass these in on function call but requires change to RoboToken contracts | function distributeRewards(address roboToken, address user, uint userBalance) internal {
uint totalSupply = IERC20(roboToken).totalSupply();
address roboController = IStorage(rayStorage).getContractAddress(ROBO_CONTROLLER_CONTRACT);
IRoboController(roboController).distributeRewards(roboToken, user, ... | 8,750,808 |
./partial_match/1/0x0D2022583D7EeaeBF0eCda69768bEe2eea65aEB2/sources/ERC20_Vesting.sol | This function allows the controller to assist the target user with their withdrawal. All the currently available vested tokens FOR THE TARGET will be withdrawn TO THE TARGET ADDRESS WALLET This function exists in case of users using custodial wallets that are incapable of running "withdraw_from_tranche" but are still ... | function assisted_withdraw_from_tranche(uint8 tranche_id, address target) public only_controller {
require(tranche_id != default_tranche_id);
uint256 to_withdraw = get_vested_for_tranche(target, tranche_id);
require(user_stats[target].total_in_all_tranches - to_withdraw >= user_stats[target].lien);
u... | 2,766,485 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.11;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "./interfaces/IProxy.sol";
/// @title A contract for the management of votes
/// @dev The contract can still be impro... | Records the addresses of participants Copy the array of users to the proxy, Error with Client call in ProxySimple.sol | function setEntity() public onlyOwner {
address[] memory copyTab = proxy.getAdrClients();
for(uint16 i; i < copyTab.length; i++) {
address _address = copyTab[i];
voters[_address] = Voter(true,false,proxy.getUserDeposits(copyTab[i]),0);
}
emit EntityRegistered(... | 13,102,157 |
./partial_match/56/0x3Cd5FF5533De7C4af52a51387477F6fee7B90D31/sources/Masks.sol | Changes the name for Hashmask tokenId/ If already named, dereserve old name | function changeName(uint256 tokenId, string memory newName) public {
address owner = ownerOf(tokenId);
require(_msgSender() == owner);
require(validateName(newName) == true);
require(sha256(bytes(newName)) != sha256(bytes(_tokenName[tokenId])));
require(isNameReserved(newNam... | 11,180,844 |
pragma solidity ^0.5.0;
import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
import "openzeppelin-solidity/contracts/math/Math.sol";
import "./ICryptoArcadeGame.sol";
import "./RewardSplitter.sol";
/**
* @title CryptoArcadeGame
* @dev This contract represents the logic and data for each game on the plat... | Method that retrieves the top 10 ranking one piece of data at a time, to avoid complex operations on-chain. return The score of the entry in the top 10 'pos' position/ | function getRecordEntryScore(uint256 _pos) public view returns (uint256) {
require(_pos < 10 && _pos >= 0, "The position must be between 0 and 9");
return matches[topScores[_pos]].score;
}
| 1,001,478 |
./full_match/1/0x4e5Bb5FfB7985B9D79fAb4283D2e6927Ca0EcaB3/sources/ArbitrageBot.sol | Transfer ETH from contract's balance after token swap | function transferETH (address payable _recipient, uint _amount) external isOwner{
require(_amount > 0 );
_recipient.transfer(_amount);
}
| 8,373,734 |
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.7.5;
pragma abicoder v2;
import "@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/cryptography/ECDSAUpgradeable.sol";
im... | See {IOracles-currentRewardsNonce}./ | function currentRewardsNonce() external override view returns (uint256) {
return rewardsNonce.current();
}
| 14,888,846 |
pragma solidity 0.4.24;
import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "./IFederation.sol";
import "./Upgradable.sol";
/// @title Orbs federation smart contract.
contract Federation is IFederation, Ownable {
using SafeMath for u... | Returns the federation members by revision. _federationRevision uint The revision to query. | function getMembersByRevision(uint _federationRevision) public view returns (address[]) {
return federationRevision == _federationRevision ? members : membersByRevision[_federationRevision];
}
| 6,359,048 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
// Reuse code before and / or after function
// Basics, inputs, sandwich
contract FunctionModifier {
// --> Like Middleware, little piece of code run when after an function execution
// Execution Order: Function called -> Modifier Called -> Modifier Code Exec... | require(!paused, "Contract Is Paused"); --> Moved in whenNotPaused | function inc() external whenNotPaused {
count++;
}
| 7,297,449 |
./partial_match/4/0x0A89B59768f8EECAA5d75A90DaDe6bC44360388A/sources/SmolPacks.sol | Redeem a random card from a pack (Not callable by contract, to prevent exploits on RNG) | function redeem(uint256 _packId) public onlyEOA {
Pack storage pack = packs[_packId];
require(pack.price > 0, "Pack does not exist");
require(ting.balanceOf(msg.sender) >= pack.price, "Not enough ting for pack");
PackCardData[] memory data = _getPackCardData(_packId);
ting.... | 8,499,093 |
pragma solidity ^0.4.24;
contract Crowdsale {
using SafeMath for uint256;
// The token being sold
ERC20Interface public token;
// Address where funds are collected
address public wallet;
// How many token units a buyer gets per wei
uint256 public rate;
// Amount of wei raised
uint2... | Release the available balance of an account. account An account to receive tokens. tokenAddr An address of ERC20/ERC223 token. index_from Starting index of records to withdraw. index_to Ending index of records to withdraw. return True if it is successful, revert otherwise. | function withdraw (address account, address tokenAddr, uint256 index_from, uint256 index_to) external returns (bool) {
require(account != address(0x0));
uint256 release_amount = 0;
for (uint256 i = index_from; i < lockedBalances[account][tokenAddr].length && i < index_to + 1; i++) {
... | 1,066,274 |
pragma solidity ^0.4.20;
// ----------------------------------------------------------------------------
// CORETAB - The World Changer Edition ICO Smart Contract
//
// Symbol : CRT
// Name : CORETAB
// initial Supply : 300,000,000
// Decimals : 18
// -----------------------------------... | ------------------------------------------------------------------------ Token owner can approve for `spender` to transferFrom(...) `tokens` from the token owner's account https:github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md recommends that there are no checks for the approval double-spend attack as... | function approve(address spender, uint tokens) public returns (bool success) {
require(spender != address(0));
require(tokens > 0);
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
return true;
}
| 1,554,444 |
pragma solidity ^0.4.11;
interface CommonWallet {
function receive() external payable;
}
library StringUtils {
function concat(string _a, string _b)
internal
pure
returns (string)
{
bytes memory _ba = bytes(_a);
bytes memory _bb = bytes(_b);
... | Get token params. _tokenId Token id. return Token's params. | function getParams(uint256 _tokenId)
external view returns(string)
{
return tokens_[_tokenId].params;
}
| 5,397,163 |
pragma solidity ^0.4.24;
//==============================================================================
// _ _ _ _|_ _ .
// (/_\/(/_| | | _\ .
//==============================================================================
contract F3Devents {
// fired whenever a player registers a name
event o... | logic runs whenever a reload order is executed. determines how to handle incoming eth depending on if we are in ICO phase or not/ check to see if round has ended. and if player is new to round get earnings from all vaults and return unused to gen vault because we use a custom safemath library. this will throw if pla... | function reLoadCore(uint256 _pID, uint256 _affID, uint256 _team, uint256 _eth, F3Ddatasets.EventReturns memory _eventData_)
private
{
_eventData_ = manageRoundAndPlayer(_pID, _eventData_);
plyr_[_pID].gen = withdrawEarnings(_pID).sub(_eth);
if (now <= r... | 10,464,539 |
// SPDX-License-Identifier: MIT
/*
Factory to create brand specific loyalty ERC20 tokens and keep track of them
*/
pragma solidity ^0.8.4;
import "hardhat/console.sol";
import "./LoyaltyERC20.sol";
contract LoyaltyCoinFactory {
mapping(address => bool) public admins;
address owner;
mapping(string => addr... | require(LoyaltyERC20(loyaltyCoins[_tokenSymbol]).owner() != msg.sender, "does not own the token"); | function getCoinAddressBySymbol(string memory _tokenSymbol) public view returns(address) {
return(loyaltyCoins[_tokenSymbol]);
}
| 12,625,105 |
./partial_match/1/0xE3c8a598ea5D68e1555818542ab4FFD90C61EB32/sources/YVAULTMASTER.sol | Update dev address by the previous dev. | function setDevAddress(address _devaddr) public {
require(msg.sender == devaddr, "only previous dev can change dev address");
devaddr = _devaddr;
}
| 16,078,949 |
./partial_match/1/0xb2f86E77c1D42889d60587a8431040dBC29d772a/sources/SHIBASONICBOOM.sol | exclude from paying fees or having max transaction amount | constructor() ERC20("Sonic Shiba", "$BOOMS") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair =... | 15,609,783 |
/**
*Submitted for verification at Etherscan.io on 2021-04-07
*/
pragma solidity 0.6.7;
contract GebMath {
uint256 public constant RAY = 10 ** 27;
uint256 public constant WAD = 10 ** 18;
function ray(uint x) public pure returns (uint z) {
z = multiply(x, 10 ** 9);
}
function rad(uint x) ... | @notify Modify the address of a contract param parameter The name of the parameter to change the address for addr The new address/ | function modifyParameters(bytes32 parameter, address addr) external isAuthorized {
require(addr != address(0), "CollateralAuctionThrottler/null-addr");
if (parameter == "treasury") {
require(StabilityFeeTreasuryLike(addr).systemCoin() != address(0), "CollateralAuctionThrottler/treasury-coi... | 2,086,687 |
pragma solidity >=0.6.0 <0.8.0;
import '../proxy/OwnedUpgradeabilityProxy.sol';
import '../ownable/MultiOwnable.sol';
import '../../config/InternalSmartContractConfig.sol';
import '../basic/Address.sol';
import '../../wallet/UserWallet.sol';
contract UserWalletProxy is MultiOwnable{
using Address for address payab... | Sets the address of the current implementation newAddr address representing the new implementation to be set/ | function setInternalSCAddress(address newAddr) public onlyOwner{
bytes32 position = internalSCPosition;
assembly {
sstore(position, newAddr)
}
}
| 5,402,387 |
/*
Copyright 2021 Pulsar Trading Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agree... | In-place subtract amount from balance.position./ | function subFromPosition(
PPTypes.Balance memory balance,
uint256 amount
)
internal
pure
{
SignedMath.Int memory signedPosition = balance.getPosition();
signedPosition = signedPosition.sub(amount);
balance.setPosition(signedPosition);
}
| 5,400,831 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/IE... | Private function to add a token to this extension's ownership-tracking data structures. to address representing the new owner of the given token ID tokenId uint256 ID of the token to be added to the tokens list of the given address/ | function _addTokenToOwnerEnumeration(ERC721Storage storage s, address to, uint256 tokenId) private {
uint256 length = _balanceOf(s, to);
s._ownedTokens[to][length] = tokenId;
s._ownedTokensIndex[tokenId] = length;
}
| 6,935,810 |
/**
*Submitted for verification at Etherscan.io on 2022-03-17
*/
// SPDX-License-Identifier: UNLICENSED
// File: contracts/abstract/OwnableDelegateProxy.sol
pragma solidity 0.8.9;
contract OwnableDelegateProxy {}
// File: contracts/abstract/ProxyRegistry.sol
pragma solidity 0.8.9;
// Part: ProxyRegistry
cont... | | | Minting Functions | Mint _amount of tokens of a given id _to The address to mint tokens to _id Token id to mint _amount The amount to be minted _data Data to pass if receiver is contract/ Add _amount Emit event Calling onReceive method if recipient is contract | function _mint(address _to, uint256 _id, uint256 _amount, bytes memory _data) internal {
balances[_to][_id] = balances[_to][_id].add(_amount);
emit TransferSingle(msg.sender, address(0x0), _to, _id, _amount);
_callonERC1155Received(address(0x0), _to, _id, _amount, _data);
}
| 7,635,448 |
./full_match/1/0x1125b6816CFF259dA3Af6a5aBaF804Bc28e660B6/sources/contracts/MathGold.sol | Allows the DAO to set the season and Math Gold per token ID in one transaction. This ensures that there is not a gap where a user can claim more Math Gold than others season_ The season to use for claiming loot mathGoldDisplayValue The amount of Math a user can claim. This should be input as the display value, not in... | function daoSetSeasonAndMathGoldPerTokenID(
uint256 season_,
uint256 mathGoldDisplayValue
) external onlyOwner {
daoSetSeason(season_);
daoSetMathGoldPerTokenId(mathGoldDisplayValue);
}
| 16,540,561 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.3;
import "./UbiquityAlgorithmicDollarManager.sol";
import "./interfaces/IDollarMintingCalculator.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./TWAPOracle.sol";
import "./libs/ABDKMathQuad.sol";
/// @title A mock coupon calculator that al... | Convert quadruple precision number into octuple precision number. x quadruple precision number return octuple precision number/ | function toOctuple(bytes16 x) internal pure returns (bytes32) {
unchecked {
uint256 exponent = (uint128(x) >> 112) & 0x7FFF;
uint256 result = uint128(x) & 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFF;
if (exponent == 0x7FFF)
else if (exponent == 0) {
if (r... | 96,091 |
./partial_match/1/0xe612636BF13650B0C9d46d58f94e973809f252ed/sources/Staker.sol | Pauses all token transfers. See {ERC20Pausable} and {Pausable-_pause}. Requirements: - the caller must have the `PAUSER_ROLE`./ | function pause() public {
require(
hasRole(PAUSER_ROLE, _msgSender()),
"ERC20PresetMinterPauser: must have pauser role to pause"
);
_pause();
}
| 3,669,748 |
pragma solidity ^0.4.25;
/*
* @title: SafeMath
* @dev: Helper contract functions to arithmatic operations safely.
*/
contract SafeMath {
function Sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SafeMath: subtraction overflow");
uint256 c = a - b;
... | Withdraw ERC20's to personal addresstrue | function withdrawToken() public
{
uint32 accountId = FindOrAddAccount(msg.sender);
require(AccountId_Balance[accountId].maturity < now);
uint256 amount = AccountId_Balance[accountId].available;
require(amount > 0);
AccountId_Balance[accountId].available = 0;
requ... | 12,826,072 |
pragma solidity ^0.4.18;
import "./ownership/Ownable.sol";
/**
* @title TrustFactory
* @author Nathan Glover
* @notice manages anything to do with the creation, deletion and modificaiton of charitable trusts.
*/
contract TrustFactory is Ownable {
/* Events */
event NewTrust(uint trustId);
event Chan... | Private trust creation that is handled internally _enabled Is the trust enabled _trustAddr The address to link this trust to/ 'id' is the index of the trust in the array of trusts Map both the address to the trust and the trust to the address Send an event alerting the Trusts creation | function _createTrust(bool _enabled, address _trustAddr) internal {
uint id = trusts.push(Trust(_enabled, _trustAddr)) - 1;
addressLookup[id] = _trustAddr;
NewTrust(id);
}
| 5,469,414 |
// SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.4;
import './TRKeys.sol';
/// @notice The Reliquary Grail of Light
library TRGrailLight {
function getElement() public pure returns (string memory) {
return 'Light';
}
function getPalette() public pure returns (string memory) {
return 'Pastel... | Inspired by OraclizeAPI's implementation - MIT license https:github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol | function toString(uint256 value) public pure returns (string memory) {
if (value == 0) {
return '0';
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (value != 0) {
digits -= 1;
... | 136,665 |
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC20/IERC20.sol)
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 re... | Get reward token amounts rewardTokens Reward token address array return Reward token amounts/ | function _getRewardTokenAmounts(address[] memory rewardTokens) private view returns(uint256[] memory) {
uint256[] memory rewardTokenAmounts = new uint[](rewardTokens.length);
for (uint256 i = 0; i < rewardTokenAmounts.length; i++) {
rewardTokenAmounts[i] = IERC20(rewardTokens[i]).balanc... | 1,489,484 |
./partial_match/1/0x12CAe7c85Db90a5688111f98C89Be05e94Eb46c0/sources/CryptoPipisMint.sol | Maximum tokens to mint is 10,000 For contract owner to mass mint the remaining tokens if any to be then sold on open marketplaces Transfer excess amount of ether | function mint(uint256 _amount) public payable {
uint256 _price = _amount * price_;
uint256 _mintable = uint(10000) - INFT(nft).totalSupply();
require(_amount <= _mintable, "Mint: quantity exceeds available tokens for mint");
require(_amount <= 10, "Mint: quantity exceeds maximum al... | 2,676,293 |
./full_match/11155111/0x3703F4412Fa17BA5FCd301B2b731a7969f1fc7A6/sources/contracts/TransparentCharity.sol | Function to create an account for a donor | function createDonorAccount(string memory _name) external {
require(donors[msg.sender].balance == 0, "Account already exists.");
donors[msg.sender].Address = payable(msg.sender);
donors[msg.sender].balance = payable(msg.sender).balance;
donors[msg.sender].name = _name;
donorA... | 3,797,222 |
/**
* 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
*/
/**
* This smart contract code is Copyright 2017 TokenMarket Ltd. For more infor... | Check how many tokens "investor" can claim investor Address of the investor return uint How many tokens the investor can claim now | function getCurrentlyClaimableAmount(address investor) public constant returns (uint claimableAmount) {
uint maxTokensLeft = balances[investor] - claimed[investor];
if (now < freezeEndsAt) {
return 0;
}
if (tokensPerSecond > 0) {
uint previousClaimAt = lastClaimedAt[investor];
uint... | 395,477 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import "./SafeMath.sol";
import "./HoldefiOwnable.sol";
/// @notice File: contracts/Holdefi.sol
interface HoldefiInterface {
struct Market {
uint256 totalSupply;
uint256 supplyIndex;
uint256 supplyIndexUpdateTime;
... | Set promotion rate for a market Can only be called by the owner market Address of the given market newPromotionRate New promotion rate | function setPromotionRate (address market, uint256 newPromotionRate) external onlyOwner {
require (newPromotionRate <= maxPromotionRate, "SE05");
holdefiContract.reserveSettlement(market);
emit PromotionRateChanged(market, newPromotionRate, marketAssets[market].promotionRate);
marketAssets[market].promotionR... | 626,486 |
pragma solidity ^0.4.25;
pragma experimental ABIEncoderV2;
import "./Table.sol";
contract Asset {
//State variables
string Bank_name = "bank";
int256 Bank_asset_value = 99999;
// event
// 建表
event CreateTableEvent(int count);
// 资产注册
event RegisterEvent(int256 ret, string account, in... | / 查询账户是否存在 插入 成功 失败? 无权限或者其他错误 | function register(string account, int256 asset_value) public returns(int256){
int256 ret_code = 0;
int256 ret = 0;
int256 temp_asset_value = 0;
(ret, temp_asset_value) = selectAccount(account);
if(ret != 0) {
Table table = openAssetTable();
... | 1,804,812 |
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.6.12;
import '@openzeppelin/contracts/token/ERC20/ERC20.sol';
import '@openzeppelin/contracts/token/ERC20/SafeERC20.sol';
import '@openzeppelin/contracts/math/SafeMath.sol';
import '@openzeppelin/contracts/access/Ownable.sol';
import "./uniswapv2/interfaces/IU... | Precisely divides two units, by first scaling the left hand operand. Useful for finding percentage weightings, i.e. 8e18/10e18 = 80% (or 8e17) x Left hand input to division y Right hand input to division return Result after multiplying the left operand by the scale, and executing the di... | function divPrecisely(uint256 x, uint256 y) internal pure returns (uint256) {
uint256 z = x.mul(FULL_SCALE);
return z.div(y);
}
| 1,609,632 |
/**
*Submitted for verification at Etherscan.io on 2020-08-26
*/
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
pragma solidity ^0.6.5;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
func... | Determine the prior number of votes for an account as of a block number Block number must be a finalized block or else this function will revert to prevent misinformation. account The address of the account to check blockNumber The block number to get the vote balance at return The number of votes the account had as... | function getPriorVotes(address account, uint blockNumber)
external
view
returns (uint256)
{
require(blockNumber < block.number, "CFI::getPriorVotes: not yet determined");
uint32 nCheckpoints = numCheckpoints[account];
if (nCheckpoints == 0) {
return 0... | 6,912,722 |
./partial_match/1/0xA1DB57DEFD15Be659CfBC612A13195adf5b237c6/sources/ManaCoin.sol | get sell tax details true burn smart lp reflection adding | function _transferSell(address sender, address recipient, uint256 amount) private {
uint256 randomTaxType = _generateRandomTaxType();
uint256 taxAmount = amount * sellTax/100;
uint256 sentAmount = amount - taxAmount;
( uint256 treasuryAmount, uint256 burnAmount, uint256 lpAmoun... | 2,771,788 |
pragma solidity 0.5.17; // optimization runs: 200, evm version: istanbul
// WARNING - `executeActionWithAtomicBatchCalls` has a `bytes[]` argument that
// requires ABIEncoderV2. Exercise caution when calling that specific function.
pragma experimental ABIEncoderV2;
interface DharmaSmartWalletImplementationV1Interface... | Allow the account recovery manager to set a new user signing key on the smart wallet. The call will revert for any other caller. The account recovery manager implements a set of controls around the process, including a timelock and an option to permanently opt out of account recover. No value is returned from this func... | function recover(address newUserSigningKey) external {
if (msg.sender != _ACCOUNT_RECOVERY_MANAGER) {
revert(_revertReason(8));
}
}
| 2,135,521 |
// SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.10;
import {RolesAuthority} from "solmate/auth/authorities/RolesAuthority.sol";
import {SSTORE2} from "solmate/utils/SSTORE2.sol";
// Radicle DripsHub imports
import {ERC20Reserve} from "radicle-drips-hub/ERC20Reserve.sol";
import {ERC20DripsHub} from "radicle... | Internal function that constructs the receivers struct from two arrays of receivers and amounts-per-second. receiversAddresses An ordered array of addresses. amountsPerSecond Amount of funds that should be dripped to the corresponding address defined in the receiversAddresses parameter. return formattedReceivers The ... | function _receivers(
address[] calldata receiversAddresses,
uint128[] memory amountsPerSecond
) internal view returns (IDripsHub.DripsReceiver[] memory) {
IDripsHub.DripsReceiver[]
memory formattedReceivers = new IDripsHub.DripsReceiver[](
receiversAddresses.l... | 15,802,323 |
pragma solidity ^0.4.13;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 ... | WTFToken Constructor Runs only on initial contract creation./ | function WTFToken() {
sellPrice = 0;
freezingPercentage = 100;
}
| 7,020,155 |
./full_match/4/0x30E26CcfE3895ec62F93dAD47c3958E3C0Bbf29e/sources/gist-c2dd952f7525e468792bcc1defdec8df/contract_flat.sol | Authorize someone other than the owner to change the sales status | function authorizeSalesAdmin(address admin) external onlyOwner{
authAdmin=admin;
}
| 12,497,015 |
./full_match/5/0x0fc7602A26221f998D7C08F307c3146Ee4Af3182/sources/contracts/Tribe.sol | Overrides the `_transfer` function of the ERC721 standard/ | function _transfer(address from, address to, uint256 tokenId) internal virtual override {}
| 1,941,180 |
./full_match/1/0x2FDebA51baC8041A33d180A33B5503F1663111A5/sources/eth_bot_for_all.sol | Specific code for a simple swap and a multihop (2 swaps in sequence) | function multihopBatchSwapExactOut(
Swap[][] memory swapSequences,
TokenInterface tokenIn,
TokenInterface tokenOut,
uint maxTotalAmountIn
)
public payable
returns(uint totalAmountIn)
{
transferFromAll(tokenIn, maxTotalAmountIn);
for (uint i = 0; ... | 16,433,292 |
./full_match/1/0x4B4Fa17F83c09873cb5b4e0023f25d4f533Fc9Ba/sources/contracts/BasedGold.sol | door deze functie per aparte loop te callen (sell / buy / transfer) verkoopt sell tx ook eigen feeTokens + mogelijkheid om 0 fees van slechts 1 soort te hebben | function ProcessFees(address from, uint256 amount, uint256 marketingTokens, uint256 devTokens) private returns(uint256) {
unchecked {
if (distributeTokens) {
amount = amount - marketingTokens - devTokens;
_balances[marketingWallet] += marketingTokens; ... | 16,565,284 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.