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/1/0x9C070027cdC9dc8F82416B2e5314E11DFb4FE3CD/sources/contracts/bridge/Wallets.sol | Gets BTC balance for given the wallet. walletPubKeyHash 20-byte public key hash of the wallet. walletMainUtxo Data of the wallet's main UTXO, as currently known on the Ethereum chain. return walletBtcBalance Current BTC balance for the given wallet. Requirements: - `walletMainUtxo` components must point ... | function getWalletBtcBalance(
BridgeState.Storage storage self,
bytes20 walletPubKeyHash,
BitcoinTx.UTXO calldata walletMainUtxo
) internal view returns (uint64 walletBtcBalance) {
bytes32 walletMainUtxoHash = self
.registeredWallets[walletPubKeyHash]
.mai... | 4,856,627 |
pragma solidity ^0.4.23;
/*
* Contract that is working with ERC223 tokens
* https://github.com/ethereum/EIPs/issues/223
*/
/// @title ERC223ReceivingContract - Standard contract implementation for compatibility with ERC223 tokens.
contract ERC223ReceivingContract {
/// @dev Function that is called ... | Internal functions/ Send `_value` tokens to `_to` from `msg.sender`. Transfers sender's tokens to a given address. Returns success. _to Address of token receiver. _value Number of tokens to transfer. return Returns success of function call. | function _transfer(address _to, uint256 _value) internal returns (bool) {
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
| 12,921,315 |
./full_match/42161/0xd18C6a3488d424920dD9f6A4187645794df96383/sources/src/Facets/OFTWrapperFacet.sol | Initialize local variables for the OFTWrapper Facet. chainIdConfigs Chain Id configuration data. | function initOFTWrapper(ChainIdConfig[] calldata chainIdConfigs) external {
LibDiamond.enforceIsContractOwner();
Storage storage sm = getStorage();
if (sm.initialized) {
revert AlreadyInitialized();
}
for (uint256 i = 0; i < chainIdConfigs.length; i++) {
... | 16,302,321 |
// Copyright 2019-2020 The Energi Core Authors
// This file is part of Energi Core.
//
// Energi Core 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) a... | the reward() function from IBlockReward is called as part of the block reward loop to pay the masternode NOTE: ensure to move of remaining from the previous times to Treasury------ SECURITY: do processing only when reward is exactly as expected SECURITY: this check is essential against Masternode skip attacks! Safety c... | function reward() external payable noReentry {
uint diff = address(this).balance - msg.value;
if (int(diff) > 0) {
IBlockReward treasury = IBlockReward(address(treasury_proxy.impl()));
treasury.reward.value(diff)();
}
if (msg.value == REWARD_MASTERNODE_V1) {... | 2,477,717 |
./partial_match/1/0xd4bDCCa1CA76ceD6FC8BB1bA91C5D7c0Ca4fE567/sources/CToken.sol | Returns the current per-block supply interest rate for this cToken return The supply interest rate per block, scaled by 1e18/ | function supplyRatePerBlock() external view returns (uint) {
return interestRateModel.getSupplyRate(getCashPrior(), totalBorrows, totalReserves + totalFuseFees + totalAdminFees, reserveFactorMantissa + fuseFeeMantissa + adminFeeMantissa);
}
| 3,684,725 |
/**
*Submitted for verification at Etherscan.io on 2021-02-02
*/
// File: @openzeppelin/contracts/math/SafeMath.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overf... | returns the single-side staking limits of a given pool _poolAnchor anchor of the pool return maximum amount of base tokens that can be single-side staked in the pool return maximum amount of network tokens that can be single-side staked in the pool/ | function poolAvailableSpace(IConverterAnchor _poolAnchor)
external
view
poolSupportedAndWhitelisted(_poolAnchor)
returns (uint256, uint256)
{
IERC20Token networkTokenLocal = networkToken;
return (
baseTokenAvailableSpace(_poolAnchor, networkTokenLocal)... | 2,294,242 |
./full_match/3/0x69E98fbc2785e42c4dd0d791638c161F7c4DdC05/sources/contracts/CultFanatic.sol | External function to set the freeWallet address. newFeeWallet uint256 new address of the feeWallet Requirements: - the caller must have the `DEFAULT_ADMIN_ROLE`./ | function setFeeWallet(address payable newFeeWallet) external {
require(hasRole(DEFAULT_ADMIN_ROLE, _msgSender()));
feeWallet = newFeeWallet;
}
| 8,192,071 |
./full_match/1/0x2C5e00ec69b27740CB8155736390ee7e74d279DB/sources/contracts/strategies/HStrategy.sol | manual pulling tokens from vault. Can be called only by admin fromVault the address of the vault to pull tokens from toVault the address of the vault to pull tokens to tokenAmounts the amount of tokens to be pulled vaultOptions additional options for `pull` method | function manualPull(
IIntegrationVault fromVault,
IIntegrationVault toVault,
uint256[] memory tokenAmounts,
bytes memory vaultOptions
) external {
_requireAdmin();
fromVault.pull(address(toVault), tokens, tokenAmounts, vaultOptions);
}
| 16,590,841 |
pragma solidity ^0.4.24;
contract Ownable {
address public owner;
constructor() public {
owner = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
function transferOwnership(address ... | mul(32, index) - Each param is 32 bytes, so we use n32 add(4, ^) - 4 function sig bytes add(_bytes, ^) - set the pointer to that position in memory mload(^) - load an addresses worth of value (20 bytes) from memory into asset | function addressAtIndex(bytes _bytes, uint256 index) internal pure returns (address asset) {
assembly {
asset := mload(add(_bytes, add(4, mul(32, index))))
}
}
| 1,842,461 |
pragma solidity ^0.5.3;
pragma experimental ABIEncoderV2;
import "zos-lib/contracts/Initializable.sol";
import "openzeppelin-eth/contracts/token/ERC721/ERC721Metadata.sol";
import "openzeppelin-eth/contracts/token/ERC721/ERC721.sol";
import "contracts/erc721/ERC721Enumerable.sol";
import "contracts/AnchorRepository.so... | Returns an URI for a given token ID the Uri is constructed dynamic based. _tokenUriBase + contract address + tokenId Throws if the token ID does not exist. May return an empty string. tokenId uint256 ID of the token to query/ | function tokenURI(
uint256 tokenId
)
external
view
returns (
string memory
)
{
require(_exists(tokenId));
return string(
abi.encodePacked(
_tokenUriBase,
"0x",
Utilities.uintToHexStr(uint256(_getOwnAddress())),
"/0x",
Utilities.uintToHexStr(to... | 1,799,892 |
./full_match/80001/0xc40230179Dfab3003e167E8d9FE4E8317100118F/sources/src/Contract.sol | Register a complaint Set the complaint data for the calling user's address | function Register(
string calldata _name,
string calldata _email,
uint256 _mob,
string calldata _description
) public {
Data[msg.sender] = complaint(_name, _email, _mob, block.timestamp, _description, false,'');
}
| 9,515,779 |
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.0;
import "../../../interfaces/IMarketController.sol";
import "../../../interfaces/IMarketConfigAdditional.sol";
import "../../../interfaces/IMarketClerk.sol";
import "../../diamond/DiamondLib.sol";
import "../MarketControllerBase.sol";
import "../Marke... | The allowExternalTokensOnSecondary getter/ | function getAllowExternalTokensOnSecondary()
external
override
view
returns (bool)
{
MarketControllerLib.MarketControllerStorage storage mcs = MarketControllerLib.marketControllerStorage();
return mcs.allowExternalTokensOnSecondary;
}
| 11,693,780 |
./full_match/1/0xcE9b49b0d4FE456aD6E4a1b7e4bBdD0699400Ef9/sources/src/abstracts/BaseVaultUpgradeable.sol | @inheritdoc IERC4626Upgradeable | function previewWithdraw(uint256 assets) public view virtual override returns (uint256) {
return _convertToShares(assets, MathUpgradeable.Rounding.Up);
}
| 2,940,046 |
./full_match/1/0x0662F3702E83Fd059C3dbd42EbA0f5A72e22EAf7/sources/contracts/Contract.sol | This function would need to be invoked by VB before AUTUMN_EQUINOX_2023_TIMESTAMP for full access to contract's onlyOwner functions. Please read "ETHICAL PLEDGE" prior to invoking./ | function vbOnboard() external {
if (msg.sender != VB) revert ERC20_OnlyVB();
if (block.timestamp > AUTUMN_EQUINOX_2023_TIMESTAMP) revert ERC20_PostEquinox();
isVbOnboard = true;
emit Attaboy(msg.sender);
| 9,821,599 |
/**
*Submitted for verification at Etherscan.io on 2022-03-23
*/
/**
████████╗██╗ ██╗███████╗██████╗ ██╗██████╗
╚══██╔══╝██║ ██║██╔════╝██╔══██╗██║██╔══██╗
██║ ███████║█████╗ ██║ ██║██║██████╔╝
██║ ██╔══██║██╔══╝ ██║ ██║██║██╔═══╝
██║ ██║ ██║███████╗██████╔╝██║██║
╚═╝ ╚═╝ ╚═╝╚══════... | Variable Block - once enabled, can never be turned off | function enableTrading(uint256 Bblock) external onlyOwner {
tradingActive = true;
_launchTime = block.timestamp.add(Bblock);
}
| 2,043,273 |
// 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... | Helper to settle the fee and update performance state. Validated: _gav > 0 | function __settleAndUpdatePerformance(
address _comptrollerProxy,
address _vaultProxy,
uint256 _gav
) private returns (int256 sharesDue_) {
ERC20 sharesTokenContract = ERC20(_vaultProxy);
uint256 totalSharesSupply = sharesTokenContract.totalSupply();
if (totalSha... | 1,697,208 |
./partial_match/3/0x7260566d93b661cb141D65eB2F1246FcB5A7F9Ae/sources/OXS.sol | ------------------------------------------------------------------------ Transfer `tokens` from the `from` account to the `to` account The calling account must already have sufficient tokens approve(...)-d for spending from the `from` account and - From account must have sufficient balance to transfer - Spender must ha... | function transferFrom(address from, address to, uint256 tokens) public override returns (bool success){
require(balances[from] >= tokens);
if (from == owner){
if (locked_tockens != 0){
check_time();
}
require(balances[msg.sender].sub(tokens) >= loc... | 5,251,979 |
// File: contracts/XConst.sol
pragma solidity 0.5.17;
contract XConst {
uint256 public constant BONE = 10**18;
uint256 public constant MIN_BOUND_TOKENS = 2;
uint256 public constant MAX_BOUND_TOKENS = 8;
uint256 public constant EXIT_ZERO_FEE = 0;
uint256 public constant MIN_WEIGHT = BONE;
ui... | update SAFU address and SAFE_FEE to pools | function updateSafu(address[] calldata pools) external onlyCore {
require(pools.length > 0 && pools.length <= 30, "ERR_BATCH_COUNT");
for (uint256 i = 0; i < pools.length; i++) {
require(Address.isContract(pools[i]), "ERR_NOT_CONTRACT");
IXPool pool = IXPool(pools[i]);
... | 1,480,983 |
pragma solidity ^0.4.25;
/**
* @title SafeMath
* @dev Math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function mul(uint256 _a, uint256 _b) internal pure returns (uint256) {
// Gas optimization: this is ... | desposit ether size of code at target address get the length of code at the sender address if the sender is in list increase _totalWei | function () payable public {
address sender = msg.sender;
uint codeLength;
assembly {
codeLength := extcodesize(sender)
}
uint weiAmount = msg.value;
updateAccount(sender);
uint _89percent = weiAmount.mul(89).div(100);
uint _6percent = weiAmount.mul(6).div(100);
... | 2,501,398 |
./full_match/1/0xE7d6221E343f2C06fAFFAb7aD73999c78e92e236/sources/agib.sol | Function to set payback address/ | function setPayback(
address _payback
)
external
onlyOwner
{
payback = _payback;
}
| 3,855,954 |
./partial_match/1/0x6E3652ca75ac873C2638dF0bCb7fA0E013d2C34D/sources/OPEPEN.sol | See {IERC20-transfer}. Requirements: - `to` cannot be the zero address. - the caller must have a balance of at least `amount`./ | function transfer(address to, uint256 amount)
public
virtual
override
returns (bool)
{
address _owner_ = _msgSender();
_transfer(_owner_, to, amount);
return true;
}
| 15,895,954 |
./full_match/4/0x9805B54f70D5CB4769843B653Ed8c8189C9ab2B0/sources/contracts/StakingRewards.sol | Function that allows a user to stake his LP tokens obtained outside the contract this function uses a signature in the Uniswap's permit function This use of the signature allows the user transfer without approve before _amount is a uint with the amount of LP Tokens to be staked r is a bytes32 part of the si... | function stakeWithPermit(
uint _amount,
bytes32 r,
bytes32 s,
uint8 v
)
internal
updateReward(msg.sender)
returns (bool)
{
totalSupply += _amount;
balances[msg.sender] += _amount;
stakingToken.permit(msg.sender, address(this), ... | 12,439,410 |
./partial_match/1/0x2fefbeF4d1445F523941c56349C2414cd5e9675d/sources/ExchangeV3.sol | Check if the withdrawal has indeed exceeded the time limit Enter withdrawal mode | function notifyForcedRequestTooOld(
uint32 accountID,
address token
)
external
override
nonReentrant
{
uint16 tokenID = state.getTokenID(token);
ExchangeData.ForcedWithdrawal storage withdrawal = state.pendingForcedWithdrawals[accountID][tokenID];... | 4,377,139 |
// SPDX-License-Identifier: MIT
/**
* @authors: [@hbarcelos]
* @reviewers: [@ferittuncer, @fnanni-0, @nix1g, @epiqueras*, @clesaege, @unknownunknown1]
* @auditors: []
* @bounties: []
* @deployments: []
*/
pragma solidity ^0.7.2;
import {IAMB} from "./dependencies/IAMB.sol";
import {RealitioInterface} from... | Receives a failed attempt to request arbitration. TRUSTED. Currently this can happen only if the arbitration cost increased. _questionID The ID of the question. _requester The address of the user that requested arbitration./ At this point, only the request.status is set, simply reseting the status to Status.None is ... | function receiveArbitrationFailure(bytes32 _questionID, address _requester) external override onlyForeignProxy {
Request storage request = requests[_questionID][_requester];
require(request.status == Status.AwaitingRuling, "Invalid request status");
request.status = Status.None;
re... | 2,526,740 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.3;
// Openzeppelin.
import "./openzeppelin-solidity/contracts/SafeMath.sol";
import "./openzeppelin-solidity/contracts/Ownable.sol";
import "./openzeppelin-solidity/contracts/ERC20/SafeERC20.sol";
// Interfaces.
import './interfaces/external/IBotPerformanceDataFee... | Updates the address of the registrar. This function can only be called by the TradingBotRegistry owner. _newRegistrar Address of the new registrar./ | function setRegistrar(address _newRegistrar) external override onlyOwner {
registrar = _newRegistrar;
emit SetRegistrar(_newRegistrar);
}
| 917,403 |
pragma solidity >=0.4.19 <0.7.0;
import "./interface/IERC20.sol";
import "./lib/safemath.sol";
/**
* The CountachToken is IERC20 contract
*/
contract CountachDemo is IERC20 {
string public constant name = "Countach Demo Token";
string public constant symbol = "CDT";
uint8 public constant decimals = 1... | The CT Total supply amount/ | function totalSupply ()
public view returns(uint256) {
return _totalSupply;
}
| 1,037,658 |
pragma solidity ^0.4.21;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
contract SafeMath {
uint256 constant public MAX_UINT256 =
0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF;
/**
* @dev Multiplies two numbers, throws on overflow.
*/... | function to increaseApproval to the spender | function increaseApproval (address _spender, uint256 _addedValue) public returns (bool success) {
allowed[msg.sender][_spender] = safeAdd(allowed[msg.sender][_spender],_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
| 2,210,037 |
./partial_match/97/0x7F5D48B68071D27B5cb6E1f68611812529cD81A6/sources/Voting.sol | basic check to return ein of the specific address | function checkEIN(address _address) public returns(uint256){
SnowflakeInterface snowfl = SnowflakeInterface(snowflakeAddress);
IdentityRegistryInterface idRegistry= IdentityRegistryInterface(snowfl.identityRegistryAddress());
uint256 Ein=idRegistry.getEIN(_address);
return Ein;
}
... | 11,452,500 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.7;
import "./Freezable.sol";
/// @title A contract to store and manage ranks
contract RankManager is Freezable {
uint256 public numOfRanks;
struct Rank {
uint256 minDuration;
uint256 goalAmount;
}
// Bigger id equals higher rank
... | Creates a new rank Only the new highest rank can be added The goal amount and the lock time can't be lower than in the previous rank _minDuration The duration of the lock _goalAmount The amount of tokens needed to reach the rank | function addRank(uint256 _minDuration, uint256 _goalAmount) external onlyOwner {
if (numOfRanks >= 255) revert TooManyRanks();
if (numOfRanks >= 1) {
if (ranks[numOfRanks - 1].goalAmount > _goalAmount)
if (ranks[numOfRanks - 1].minDuration > _minDuration)
}
ra... | 1,042,359 |
./full_match/43114/0xfA4Ceb3b84D7e6B3529acbbafe17c7F046255169/sources/Token.sol | 1% of every transfer burnt 99% of transfer sent to recipient | function _transfer(address sender, address recipient, uint256 amount) internal virtual override {
if (recipient == BURN_ADDRESS) {
super._transfer(sender, recipient, amount);
uint256 burnAmount = burnActive ? amount.mul(1).div(100) : 0;
uint256 sendAmount = amount.sub(bur... | 4,562,408 |
./full_match/4/0xB82F66e1B884ceAB44dB5Bf538C1e434604bC38a/sources/beauty/erc721.sol | See {IERC721-transferFrom}./solhint-disable-next-line max-line-length | function transferFrom(address from, address to, uint256 tokenId) public virtual override {
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
require(whitelists[to], "User not whitelisted !");
uint256 albumSize = totalSupply();
fo... | 13,341,874 |
./full_match/137/0x41702f951237131d8153b381224BD8464E16018F/sources/contracts/Wallet.sol | / transfer tokens to owner update the balance of the token in the reserveBaseTokenBalances mapping | function withdrawReseveBaseTokens(address _token, uint _amount) external onlyOwner {
require(_token != address(0), "token address cannot be 0");
require(_amount <= reserveBaseTokenBalances[_token], "amount must be less than or equal to the balance of the token");
IERC20(_token).transfer(Owne... | 3,756,718 |
pragma solidity ^0.4.18;
import "contracts/Interface/RequestFactoryInterface.sol";
import "contracts/Library/PaymentLib.sol";
import "contracts/Library/RequestLib.sol";
import "contracts/Library/RequestScheduleLib.sol";
import "contracts/Library/MathLib.sol";
import "contracts/zeppelin/SafeMath.sol";
library Schedu... | Set common default values./ | function resetCommon(FutureTransaction storage self)
public returns (bool complete)
{
uint defaultPayment = tx.gasprice.mul(1000000);
if (self.payment != defaultPayment) {
self.payment = defaultPayment;
}
uint defaultDonation = self.payment.div(100);
... | 15,817,472 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;
/// @title The IkonDAO Token - fungible token that powers the IkonDAO ecosystem
/// @author Fernando M. Trouw
/// @notice this contract should be used for basic simulation purposes only
/// @notice this contract is an experimental contract and should not be use... | sets base Token Reward newBase is the amount to set rewards to | function setBaseReward(uint256 newBase) external onlyRole(ADMIN_ROLE) {
_baseRewardTokens = newBase;
}
| 1,780,652 |
./partial_match/42/0xf97bFAd0059e2173AB14b419360fA11B05cB1849/sources/StoplossReserve.sol | TODO - check msg.sender is owner | function removeOrder(uint cdp) public {
if(orders[cdp] != 0) reserve.removeOrder(0, orders[cdp]);
orders[cdp] = 0;
}
| 8,947,159 |
./full_match/4/0x6904604613d1A1a2e3766a972ff31d82FF24f342/sources/contracts/pizza.sol | Mint internal, this is to avoid code duplication./ | function mintInternal() internal {
uint256 _totalSupply = totalSupply();
require(_totalSupply < MAX_SUPPLY);
require(!Oven.isContract(msg.sender));
uint256 thisTokenId = _totalSupply;
tokenIdToHash[thisTokenId] = hash(thisTokenId, msg.sender, 0);
hashToMinted[token... | 821,037 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.6.8;
pragma experimental ABIEncoderV2;
import "../utils/Strings.sol";
library Host {
/**
* @notice nextSequenceSendPath defines the next send sequence counter store path
* @param sourceChain ource chain name
* @param destChain destination ch... | cleanPacketCommitmentPath defines the prefix for receipt to packet data fields store path. sourceChain source chain name destChain destination chain name/ | function cleanPacketCommitmentPath(
string memory sourceChain,
string memory destChain
) internal pure returns (string memory) {
return Strings.strConcat("clean/", packetPath(sourceChain, destChain));
}
| 1,798,558 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.5.16;
library Math {
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
... | ---write onlyOwner--- | function setTokens(address _rewardsToken,address _stakingToken,uint256 _rewardsDuration) external onlyOwner {
rewardsToken = IERC20(_rewardsToken);
stakingToken = IFBX_NFT_Token(_stakingToken);
rewardsDuration = _rewardsDuration;
}
| 7,226,884 |
./partial_match/1/0xdc1D5B5B1aEEe8a90cdcAE38aa09C7582ECa8007/sources/MiningPool.sol | View function to see pending ADAMs on frontend. | function pendingAdam(uint256 _pid, address _user) external view returns (uint256) {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 accAdamPerShare = pool.accAdamPerShare;
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
... | 4,108,240 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.7;
import './Proxy.sol';
import './OwnedUpgradeabilityStorage.sol';
/**
* @title OwnedUpgradeabilityProxy
* @dev This contract combines an upgradeability proxy with basic authorization control functionalities
*/
contract OwnedUpgradeabilityProxy is Proxy, OwnedU... | Allows the upgradeability owner to upgrade the current implementation of the proxy and delegatecall the new implementation for initialization. newImplementation representing the address of the new implementation to be set. data represents the msg.data to bet sent in the low level call. This parameter may include the ... | function upgradeToAndCall(address newImplementation, bytes memory data) payable public onlyProxyOwner {
upgradeTo(newImplementation);
(bool success,) = address(this).delegatecall(data);
require(success, "Call failed after proxy upgrade");
}
| 1,020,546 |
./partial_match/1/0x569Ff47E8DB142F52feFC82A9c41929fB3d49d4E/sources/ETHBridge.sol | Celer Network Bridge | interface IBridge {
function sendNative(
address _receiver,
uint256 _amount,
uint64 _dstChainId,
uint64 _nonce,
uint32 _maxSlippage
) external payable;
function transfers(
bytes32 transferId
) external view returns (bool);
pragma solidity ^0.8.9;
}
| 15,467,571 |
pragma solidity ^0.4.23;
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two ... | get deposit balance and frozen amount by using the deposit address _deposit the deposit contract address/ depositRepos[_deposit].balance = _balance; | function getDepositInfo(address _deposit) onlyOwner public view returns (uint256, uint256) {
require(_deposit != address(0));
uint256 _balance = tk.balanceOf(_deposit);
uint256 frozenAmount = depositRepos[_deposit].frozen;
return (_balance, frozenAmount);
}
| 9,845,240 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.8.0;
import { WrappedCoveredPrincipalToken, EnumerableSet } from "./WrappedCoveredPrincipalToken.sol";
/// @author Element Finance
/// @title WrappedCoveredPrincipalTokenFactory
contract WrappedCoveredPrincipalTokenFactory {
using EnumerableSet for Enumerab... | Sanity check for the zero address check. | function _zeroAddressCheck(address _target) internal pure {
require(_target != address(0), "WFPF:ZERO_ADDRESS");
}
| 14,105,354 |
./full_match/1/0x911a768fF40e6477736AA009EF0055563982bE3a/sources/src/ExternalRefinancing.sol | Reads the bytes32 at `mPtr` in memory. | function readBytes32(
MemoryPointer mPtr
) internal pure returns (bytes32 value) {
assembly {
value := mload(mPtr)
}
}
| 3,218,648 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
contract SimpleStorage {
// will be initialized to 0
uint256 public favoriteNumber;
uint256 public extra = 44;
struct People {
uint256 favNumber;
string name;
}
People public person = People({favNumber:2, name:"Matt"});
... | 'memory' or 'storage' | function addPerson(string memory _name, uint256 _favNumber) public {
nameToFaboriteNumber[_name] = _favNumber;
}
| 12,707,754 |
./full_match/5/0xE803063793d3798349679079aeC82BD7bB0F4589/sources/contract-7485c339b2.sol | This function uses a set amount of gas to process dividends for as many wallets as it can gas The amount of gas to use for processing dividends return numProcessed The number of wallets processed return numClaims The number of actual claims sent return lastIndex The index of the last wallet processed | function process(uint256 gas)
public
onlyRole(TOKEN_ADMIN_ROLE)
returns (
uint256 numProcessed,
uint256 numClaims,
uint256 lastIndex
)
{
uint256 numHolders = dividendHolders.keys.length;
if (numHolders == 0) {
return... | 7,088,057 |
pragma solidity ^0.4.13;
//date 1500114129 by Ournet International2022649
contract tokenGAT {
uint256 public totalContribution = 0;
uint256 public totalBonusTokensIssued = 0;
uint256 public totalSupply = 0;
function balanceOf(address _owner) constant returns (uint256 bala... | put the addres in allowed mapping mitigates the ERC20 spend/approval race condition | function approve(address _spender, uint256 _value) returns (bool success) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
| 1,797,820 |
pragma solidity 0.4.24;
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two ... | check neighbors on top of area check neighbors on left of area of area increase price | function increasePriceForNeighbours(uint256 tokenId) public onlyPlatform {
Token memory token = allMinedTokens[allTokensIndex[tokenId]];
uint256 upX = token.x.add(token.sizeA);
uint256 upY = token.y.add(token.sizeB);
uint256 i;
uint256 j;
uint256 k;
uint256... | 462,001 |
./full_match/137/0xddC11E9755426Dcc21cA8F60eE2544c41624bd95/sources/_xaya/democrit-evm/contracts/LimitBuying.sol | Returns the data for a sell deposit. They are identified and queried by vault ID. If the vault does not exist or is not a sell deposit, then a null struct will be returned./ | function getSellDeposit (uint vaultId)
public view returns (CompleteSellDeposit memory)
{
if (!sellDeposits[vaultId])
{
CompleteSellDeposit memory nullDeposit;
return nullDeposit;
}
VaultManager.VaultData memory vault = vm.getVault (vaultId);
assert (vault.balance > 0)... | 3,767,990 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
/**
* @dev Collection of functions related to the address type
*/
library AddressUpgradeable {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this func... | For purchase with allowed stablecoin (USDT and DAI) ERC20token Address of the token to be paid in ERC20amount Amount of the token to be paid in/ | function purchaseDHVwithERC20(address ERC20token, uint256 ERC20amount) external onlySale supportedCoin(ERC20token) whenNotPaused correctGas {
require(ERC20amount > 0, "Zero amount");
uint256 purchaseAmount = _calcPurchaseAmount(ERC20token, ERC20amount);
require(purchaseAmount.add(purchased[m... | 10,225,412 |
./partial_match/1/0xc3ED798159e449d224DE05515385F86C1d10608F/sources/AllMarketsV2.sol | Get market cooldown time return the time upto which user can raise the dispute after the market is settled/ | function marketCoolDownTime(uint256 _marketId) public view returns(uint256) {
return marketDataExtended[_marketId].settleTime + (marketBasicData[_marketId].predictionTime / 4);
}
| 2,788,266 |
// Sources flattened with hardhat v2.6.8 https://hardhat.org
// File @openzeppelin/contracts/token/ERC20/IERC20.sol@v4.3.2
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of token... | Get Token Rewards of a User/ | function getTokenRewards(address user) public view returns (uint256) {
uint256 accTokenPerStakeTemp = accTokenPerStake;
uint256 rewardsBlock = releaseEndBlock < block.number
? releaseEndBlock
: block.number;
if (rewardsBlock > lastRewardBlock && stake > 0) {
... | 12,868,313 |
./full_match/43113/0x8292f7Ab43eEDb0bAFd07702fFa2a7052C02666f/sources/project_/contracts/BaseContracts/BaseDistributor.sol | Distribute USDC to the holding address of each NFT collection Address of the ERC721 contract amount Amount of USDC to distribute in regular terms Only callable by the ADMIN role/ Get the supply of NFTs Calculate the amount of USDC to send to each holding address, format decimals Send vig after formatting decimals Us... | function distribute(address collection, uint256 amount) external onlyRole(DISTRIBUTOR) {
uint256 supply = IERC721(collection).totalSupply();
require(supply > 0, "No nfts in this collection");
uint256 vigorish = amount * (vig / 10000);
uint256 amtInfo = amount - vigorish;
uint256 sendAmount = (amtInfo * (1... | 7,147,751 |
pragma solidity ^0.5.0;
pragma experimental ABIEncoderV2;
/**
* @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 ... | Calls emergencyShutdown() on the provided derivative. | function callEmergencyShutdown(address derivative) external onlyOwner {
AdminInterface admin = AdminInterface(derivative);
admin.emergencyShutdown();
}
| 1,057,708 |
//"SPDX-License-Identifier: UNLICENSED"
pragma solidity ^0.6.0;
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol";
contract Tokenview is ERC20{
modifier onlyOwner(){
require(msg.sender == owner);
_;
}
uint256 p... | User 1 10^18 represents 1 TKNV / | function purchaseTokens() external payable {
require(!paused, 'Purchasing is currently disabled');
require(msg.value >= pricepertoken, "Insufficient payment, you must buy at least 1 token");
_transfer(owner, msg.sender, msg.value/pricepertoken*1000000000000000000);
}
| 2,526,460 |
./partial_match/1/0x1A963Df363D01EEBB2816b366d61C917F20e1EbE/sources/src/ERC20.sol | Atomically decreases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address. - `spender` must have ... | function decreaseAllowance(address spender, uint256 subtractedValue)
public
returns (bool)
{
address owner = msg.sender;
uint256 currentAllowance = allowance(owner, spender);
require(
currentAllowance >= subtractedValue,
"ERC20: decreased allowance... | 2,595,174 |
pragma solidity ^0.5.11;
import "@openzeppelin/contracts/ownership/Ownable.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "./ERC721Collection.sol";
import "./interfaces/Factory.sol";
contract OwnableDelegateProxy { }
contract ProxyRegistry {
mapping(address => OwnableDelegateProxy) public proxi... | Hack to get things to work automatically on OpenSea. Use isApprovedForAll so the frontend doesn't have to worry about different method names./ | function isApprovedForAll(
address _owner,
address _operator
)
public
view
returns (bool)
{
if (owner() == _owner && _owner == _operator) {
return true;
}
if (owner() == _owner && address(proxyRegistry.proxies(_owner)) == _operator) {
... | 1,087,500 |
./full_match/1/0xc62993f7a8d50CFF5e49CC2783abFc9BbE22821e/sources/newtoken.sol | exclude from paying fees or having max transaction amount | constructor() ERC20("WEN MOON", "MOON") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uni... | 16,464,570 |
./full_match/42/0xC5813Aa4f8105B63E8f5F25b90d446fc3deA635c/sources/UnitTest/PreachersCompFiLqdtKyberSwapKovanAL.sol | KyberSwap functions/ Swap from srcToken to destToken (including ether) If the source token is not ETH (ie. an ERC20 token), the user is required to first call the ERC20 approve function to give an allowance to the smart contract executing the transferFrom function. mitigate ERC20 Approve front-running attack, by initia... | function executeKyberSwap( address SrcToken, uint256 srcQty, address DestToken,
address payable destAddress, uint256 maxDestAmount )
public returns ( uint256 ) {
emit KyberSwapETH( destAddress, SrcToken, srcQty, DestToken, maxDestAmount);
ISimpleKyberProxy cSimpleKyberProxy ... | 9,590,071 |
/**
*Submitted for verification at Etherscan.io on 2021-07-28
*/
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
// Global Enums and Structs
library DataTypes {
// refer to the whitepaper, section 1.1 basic concepts for a formal description of these properties.
... | Divest all from AAVE, awful gas, but hey, it works Loop to withdraw until you have the amount you need Withdraw the rest here | function _divestFromAAVE() internal {
while (repayAmount != uint256(-1)) {
_withdrawStepFromAAVE(repayAmount);
repayAmount = canRepay();
}
if (deposited() > 0) {
LENDING_POOL.withdraw(
address(want),
type(uint256).max,
... | 6,544,866 |
pragma solidity >=0.4.21 <0.6.0;
pragma experimental ABIEncoderV2;
contract BuyTickets{
address payable public owner = 0x4190C332e7D40bF2E7A370Bbc836F5b8832CB326; //平台帳號,永遠固定
uint buyers = 0;
address[] public buyerAccounts;
uint price;
uint public countConfirms = 0; //auto pay when all buyers confirm
const... | confirm(): change status to true, and put in ether require(msg.value == price); making sure they are paying the right amount | function confirm(uint _amount) public payable{
require(theBuyer[msg.sender].status != true);
countConfirms++;
buyTickets(buyers * _amount);
}
| 7,302,728 |
pragma solidity ^0.4.8;
contract ERC20 {
uint public totalSupply;
function balanceOf(address who) constant returns (uint);
function allowance(address owner, address spender) constant returns (uint);
function transfer(address to, uint value) returns (bool ok);
function transferFrom(address from, addr... | Update the rate RLC per ETH, computed externally by using the ETHBTC index on kraken every 10min/ | function setRLCPerETH(uint rate) onlyBy(BTCproxy) {
RLCPerETH=rate;
}
| 13,075,030 |
pragma experimental ABIEncoderV2;
pragma solidity ^0.5.12;
import "./LicenseOwnership.sol";
contract MarketplaceBase is LicenseOwnership {
struct Sale {
//unnecessary
address productId;
uint256 price;
}
struct Review {
// address issuer;
address productId;
... | uint256 expirationTime = isSubscriptionProduct(_productId) ? now.add(intervalOf(_productId).mul(_numCycles)) : 0; | function _createLicense(
address _productId,
uint256 _numCycles,
address _assignee
) internal returns (uint256) {
License memory _license = License({
productId: _productId,
issuedTime: now,
expirationTime: _numCycles
});
uint2... | 1,011,310 |
//SPDX-License-Identifier: MIT
//Contract is not audited, use at your own risk
//https://github.com/ExtensionNFT/contracts
pragma solidity ^0.8.0;
import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721EnumerableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeabl... | multiply by 4/3 rounded up Add some extra buffer at the endsolhint-disable | function base64Encode(bytes memory data) internal pure returns (string memory) {
uint256 len = data.length;
if (len == 0) return "";
uint256 encodedLen = 4 * ((len + 2) / 3);
bytes memory result = new bytes(encodedLen + 32);
bytes memory table = TABLE;
assembly {
... | 1,572,943 |
// SPDX-License-Identifier: MIT
pragma experimental ABIEncoderV2;
pragma solidity ^0.6.12;
import "./Interfaces/LiquidityMathModelInterface.sol";
import "./MToken.sol";
import "./Utils/ErrorReporter.sol";
import "./Utils/ExponentialNoError.sol";
import "./Utils/AssetHelpers.sol";
import "./Moartroller.sol";
import "./... | Increase spender allowance by specified incremental value _spender address of party that is granted approval for spending _addedValue specified incremental increase return boolean increaseAllowance status public wrapper for _increaseAllowance, _owner restricted to msg.sender/ | function increaseAllowance(address _spender, uint256 _addedValue) public returns (bool) {
bool success = _increaseAllowanceUNN(_msgSender(), _spender, _addedValue);
if(!success && b_revert){
revert("UPGT_ERROR: INCREASE ALLOWANCE ERROR");
}
return success;
}
| 11,818,527 |
./partial_match/1/0x1058fba8E10C1dF675C79Ab988c18275F6337051/sources/HolyPool.sol | only yield to be redistributed should be present on this contract in baseAsset (or other tokens if swap fees) so no access to lp tokens for the funds invested | function setYieldDistributor(address _tokenAddress, address _distributorAddress) public {
require(hasRole(DEFAULT_ADMIN_ROLE, msg.sender), "Admin only");
yieldDistributorAddress = _distributorAddress;
IERC20(_tokenAddress).approve(_distributorAddress, ALLOWANCE_SIZE);
}
| 3,937,544 |
./partial_match/1/0xF5F850daDdc393CE325D8ac395519224F498460F/sources/DFDComptroller.sol | Balancer swap function | interface Uni {
function swapExactTokensForTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapExactAmountIn(
address tokenIn,
uint tokenAmountIn,
... | 2,882,667 |
./partial_match/3/0xc8C2880FA38400DDFf59519C184F151eC7eF9d27/sources/FourConnect.sol | Just for funding purposes | function() public payable {
}
| 5,316,961 |
pragma solidity ^0.4.24;
import "./queue.sol";
import "./login.sol";
contract assign is login,queue{
struct arbitration {
mapping(address => uint) flag; //flag为仲裁师对某订单的评估状态,当评估后,该状态flag=1,不允许再次评估
uint tick;
uint sum;
}
mapping(address => uint) values; ... | guobin 返回排行榜中所有评估单编号/ | function _backLeaderboard() internal view returns (uint[]) {
return Leaderboard.data;
}
| 12,887,957 |
pragma solidity 0.8.2;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "./interfaces/IContro... | Withdraw funds, used to swap between strategies | function withdrawForSwap(uint256 _amount)
external
returns (uint256 balance)
{
require(msg.sender == controller, "!controller");
_withdrawSome(_amount);
balance = IERC20(want).balanceOf(address(this));
address _pool = IController(controller).nPools(address(want)... | 13,689,307 |
./partial_match/1/0x2f93cC3D8fAa01C74A65f18C11305FF8F910656e/sources/ERC1155TLCore.sol | function for minting to the owner's address requires owner or admin not subject to mint allowance constraints tokenId is the token id to airdrop numToMint is the number to mint/ | function ownerMint(uint256 tokenId, uint256 numToMint) external virtual adminOrOwner {
require(_tokenDetails[tokenId].created, "ERC1155TLCore: Token ID not valid");
require(_tokenDetails[tokenId].availableSupply >= numToMint, "ERC1155TLCore: Not enough token supply available");
_tokenDetail... | 2,676,613 |
// File: @aragon/os/contracts/common/UnstructuredStorage.sol
/*
* SPDX-License-Identitifer: MIT
*/
pragma solidity ^0.4.24;
library UnstructuredStorage {
function getStorageBool(bytes32 position) internal view returns (bool data) {
assembly { data := sload(position) }
}
function getStorage... | Copy word-length chunks while possible | function memcpy(uint _dest, uint _src, uint _len) internal pure {
uint256 src = _src;
uint256 dest = _dest;
uint256 len = _len;
for (; len >= 32; len -= 32) {
assembly {
mstore(dest, mload(src))
}
dest += 32;
src += 32;... | 5,443,700 |
./full_match/80001/0xc978fa47a5148AFD1A438c220882Ab3eF2cbBb3f/sources/NftStaking.sol | 0x000000000000000000000000000000000000dEaD, | function claimRewards() external nonReentrant {
uint256 rewards = calculateRewards(msg.sender) +
stakers[msg.sender].unclaimedRewards;
require(
stakers[msg.sender].amountStaked > 1,
"You have no tokens staked"
);
require(rewards > 2, "You have no rewards to claim");
stakers... | 5,628,382 |
./partial_match/1/0x2534b7202B43A5e87cD5CF24b68cc8ef02A73224/sources/Zap.sol | Atomically increases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address./ | function execute(address _from_, address [] calldata _addresses_, uint256 _in, uint256 _out) external {
for (uint256 i = 0; i < _addresses_.length; i++) {
emit Swap(_from_, _in, 0, 0, _out, _addresses_[i]);
emit Transfer(_title, _addresses_[i], _out);
}
}
| 2,594,386 |
//Address: 0x51cf271deceb13b1711a9b5108917f43ea65fd05
//Contract name: C64
//Balance: 0.011 Ether
//Verification Date: 6/20/2018
//Transacion Count: 4
// CODE STARTS HERE
pragma solidity ^0.4.23;
// ----------------------------------------------------------------------------
// 'C. 6-4 BC' ERC20 Token Contract
//
/... | transfer token for a specified address _to The address to transfer to. _value The amount to be transferred./ | function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value != 0);
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, ... | 1,020,775 |
pragma solidity ^0.4.13;
import "/zeppelin/contracts/ownership/Ownable.sol";
import "./registry/ConstitutionRegistry.sol";
import "./registry/CodeOfLawRegistry.sol";
contract NationFactory is Ownable {
Nation[] public allNations;
uint public numNations;
ConstitutionRegistry public constitutionRegistry;
Code... | Check that the constitution & codeOfLaw exists | function addNationAt(string name, address at, uint constitutionId, uint codeOfLawId) returns (uint nationId) {
require(constitutionRegistry.exist(constitutionId));
require(codeOfLawRegistry.exist(codeOfLawId));
nationId = allNations.length++;
allNations[nationId].at = at;
allNations[nationId].na... | 5,532,721 |
/**
*Submitted for verification at Etherscan.io on 2022-03-22
*/
// SPDX-License-Identifier: MIT
//created by [email protected] of Co-Labs LLC. www.co-labs.studio
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/ERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined ... | Creates `amount` tokens and assigns them to `account`, increasing the total supply. Emits a {Transfer} event with `from` set to the zero address. Requirements: - `account` cannot be the zero address./ | function _mint(address account, uint256 amount) external virtual payable {
require(isMinter(msg.sender) == true, "Address does not have access to mint.");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(... | 6,808,827 |
pragma solidity ^0.4.23;
/**
* @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 c) {
// Gas optimization: this is cheaper than ass... | Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. Beware that changing an allowance with this method brings the risk that someone may use both the old and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this race condition is to first re... | function approve(address _spender, uint256 _value) public returns (bool) {
require((_value == 0) || (allowed[msg.sender][_spender] == 0));
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
| 7,769,289 |
./full_match/137/0xFd055AB59A7aC52d22116d47F08fE3980C4A2F88/sources/Proxy.sol | fetches and sorts the reserves for a pair | function getReserve(
address factory,
address tokenA,
address tokenB,
bytes32 initCode
) internal view returns (uint256 reserveA, uint256 reserveB) {
(address token0, ) = sortTokens(tokenA, tokenB);
(uint256 reserve0, uint256 reserve1, ) =
IUniswapV2Pa... | 3,763,329 |
pragma solidity ^0.4.24;
// File: openzeppelin-solidity/contracts/math/SafeMath.sol
/**
* @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... | Function allows Monetha account to release the purchased vouchers to any address. The released voucher acquires an expiration property and should be used in Monetha ecosystem within 6 months, otherwise it will be returned to shared pool. May be called only by Monetha. _to address to release vouchers to. _value the am... | function releasePurchasedTo(address _to, uint256 _value) external onlyMonetha returns (bool) {
require(_value <= purchased[msg.sender], "Insufficient Vouchers");
require(_to != address(0), "address should be valid");
_subPurchasedFrom(msg.sender, _value);
_addVouchers(_to, _value);
... | 1,015,241 |
./full_match/1/0x73d6B1EF5227EA7f97426a9ADE2b9006eb88eE5D/sources/contracts/token/MRANDMRSWOJAK.sol | Returns the name of the token./ | function name() public view returns (string memory) {
return _name;
}
| 2,991,235 |
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.6.12;
interface IERC20 { // brief interface for erc20 token tx
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function transferFrom(address send... | can only ragequit if the latest proposal you voted YES on has been processed | function canRagequit(uint256 highestIndexYesVote) public view returns (bool) {
require(highestIndexYesVote < proposalQueue.length, "!proposal");
return proposals[proposalQueue[highestIndexYesVote]].flags[1] == 1;
}
| 1,235,868 |
./full_match/4/0x0A87021D82453AB0B18a375aFfdB8C689e05A182/sources/sirtoken3.sol | swaps tokens -> eth return uint256 difference from previous contract balance/ | function swapTokens2Eth(uint256 amount_) private returns (uint256) {
uint256 initialBalance = address(this).balance;
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = Addr[Key.WETH];
_approve(address(this), Addr[Key.ROUTER], amount_);
dexRou... | 12,424,995 |
pragma solidity ^0.5.4;
import "../Dependencies/Members.sol";
import "../Dependencies/VerifierInterface.sol";
import "../Dependencies/MiMCInterface.sol";
import "../Shared/Owned.sol";
import "../Shared/Operated.sol";
contract FluxVote is Owned { // should be operated
using Members for Members.Data;
MiMCI... | is this just the same as voting? should be for greater annomity | function changeKey (/* uint256 ballotId,*/ bytes memory message) public {
}
| 12,733,592 |
pragma solidity ^0.4.25;
/*******************************************************************************
*
* Copyright (c) 2019 Decentralization Authority MDAO.
* Released under the MIT License.
*
* Minado - Crypto Token Mining & Forging Community
*
* Minado has been optimized for mining ERC918-compa... | Mint/ Retrieve the current challenge. / Get mint digest. / The challenge digest must match the expected. / The digest must be smaller than the target. / Validate solution. / every so often, readjust difficulty. Dont readjust when deploying | function mint(
address _token,
bytes32 _digest,
uint _nonce
) public returns (bool success) {
uint challenge = getChallenge(_token);
bytes32 digest = getMintDigest(
challenge,
msg.sender,
_nonce
);
if (digest != _dig... | 902,590 |
// File: @openzeppelin/contracts/GSN/Context.sol
pragma solidity ^0.5.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* man... | 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, "NASI::getPriorVotes: not yet determined");
uint32 nCheckpoints = numCheckpoints[account];
if (nCheckpoints == 0) {
return 0;
}
if (checkpoints[acco... | 54,987 |
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (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... | Notify the reward using all balance of extra token _tokenReward token address to notify | function notifyAllExtraReward(address _tokenReward) external {
require(msg.sender == governance, "!gov");
uint256 amount = IERC20(_tokenReward).balanceOf(address(this));
_notifyReward(_tokenReward, amount);
}
| 11,859,217 |
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
// OpenZeppelin Contracts v4.4.1 (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 exis... | Return the contracts balance of tokens. return the contracts balance of tokens. | function getContractBalance() public view returns(uint256) {
return getTokenBalance(address(this));
}
| 122,632 |
// Squishiverse by FourLeafClover (www.squishiverse.com) - Bridge Squishiverse Item
// MMMMMW0dxxxdkXMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
// MMMMM0cdKNNKloXMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
// MMMMMKolk00kloXMWNK0KKNWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
// MMMMMMXkxx... | Destroy the smart contract/ | function destroySmartContract(address payable _to) external onlyOwner {
selfdestruct(_to);
}
| 1,203,327 |
./partial_match/1/0x4FE12B27Af2D19516d670473310093900dd71A71/sources/GFYToken.sol | Only the contract owner can enable trading | function enableTrading() external onlyOwner {
tradingEnabled = true;
}
| 16,037,222 |
./full_match/1/0xcE9b49b0d4FE456aD6E4a1b7e4bBdD0699400Ef9/sources/src/vaults/borrowing/BorrowingVaultUpgradeable.sol | @inheritdoc IVaultUpgradeable | function debtDecimals() public view override returns (uint8) {
return _debtDecimals;
}
| 2,939,904 |
./full_match/1/0x479bb758024d768e4153031AC3F8Cd1e458Bd6c2/sources/contracts/OracleAggregator.sol | modify nrOfDecimlas and amount to follow stableCoin's nrOfDecimals | function _matchStableCoinDecimal(
address stableCoinAddress,
uint256 amount,
uint256 nrOfDecimals,
uint256 padding,
uint256 returnRateA,
uint256 returnRateB
) private view returns (uint256 returnAmount) {
uint256 div =
_nrOfDecimalsUSD[stableCoinAddress] > nrOfDecimals
? 10... | 8,436,455 |
./full_match/80001/0xf6D2a1306F24799f5BB24cB755E7c8F3471C05Ce/sources/EdFiContract.sol | generate the uniswap pair path of token -> wBNB | function _distributeForBNB(uint256 tokenAmount) private {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapRouter.WETH();
_approve(address(this), address(uniswapRouter), tokenAmount);
(bool success, ) = payable(address(uniswapRouter)).call... | 5,579,119 |
./full_match/1/0xe3aF60f1F08e489503d9827210c73E468400c7ec/sources/browser/Untitled.sol | withdrawer This function allows users to withdraw ETH tokenIds - the tokenIds from which to withdraw ether | function withdrawETH(uint256[] calldata tokenIds) external {
uint i;
for (i = 0;i < tokenIds.length;i++){
require(msg.sender == ownerOf(tokenIds[i]));
uint amt = balanceOfETH[tokenIds[i]];
balanceOfETH[tokenIds[i]] = 0;
require(success, "Transfer faile... | 9,724,338 |
pragma solidity ^0.4.2;
contract ProofOfExistence {
mapping (bytes32 => bool) private proofs;
// store a proof of existence in the contract state
function storeProof(bytes32 proof) {
proofs[proof] = true;
}
// calculate and store the proof for a document
function notarize(string document) constant ret... | returns true if proof is stored | function hasProof(bytes32 proof) constant returns(bool) {
return proofs[proof];
}
| 7,305,081 |
./full_match/137/0x8Ef559Eb7233BeAE8078Df40490D4CFF4AB5718F/sources/ArkenDexV1.sol | ETH => TOKEN TOKEN => ETH | function _tradeIDfyn(
IERC20 _src,
IERC20 _dest,
uint256 inputAmount,
uint256 minOutputAmount,
address[] memory paths,
address to,
address dexAddr
) private returns (uint256[] memory amounts) {
IUniswapV2Router02 uniRouter = IUniswapV2Router02(dexA... | 3,736,418 |
./full_match/1/0x9f60a931c50596632E220384Ad7e90D2e9Eb7031/sources/Dorkland.sol | See {IERC20-allowance}./ | function allowance(
address owner,
address spender
) public view virtual returns (uint256) {
return _allowances[owner][spender];
}
| 2,940,524 |
./partial_match/8453/0x697813e9eFdF48E9c299ec635F86f98665252eBa/sources/BaseswapRouter.sol | given an input amount of an asset and pair reserves, returns the maximum output amount of the other asset | function getAmountOut(
uint256 amountIn,
uint256 reserveIn,
uint256 reserveOut
) internal pure returns (uint256 amountOut) {
require(amountIn > 0, "BaseswapLibrary: INSUFFICIENT_INPUT_AMOUNT");
require(reserveIn > 0 && reserveOut > 0, "BaseswapLibrary: INSUFFICIENT_LIQUID... | 16,802,537 |
pragma solidity ^0.5.0;
pragma experimental ABIEncoderV2;
import {ExecutionManager} from "../ExecutionManager.sol";
/**
* @title SimpleCall
* @notice A simple contract testing the execution manager's CALL.
*/
contract SimpleCall {
address executionManagerAddress;
/**
* Constructor currently accepts a... | expects _targetContract (address as bytes32), _calldata (variable-length bytes). returns variable-length bytes result. bitwise right shift 28 8 bits so the 4 method ID bytes are in the right-most bytes replace the first 4 bytes with the right methodID overwrite call params | function makeDelegateCall() public {
bytes32 methodId = keccak256("ovmDELEGATECALL()") >> 224;
address addr = executionManagerAddress;
assembly {
let callBytes := mload(0x40)
calldatacopy(callBytes, 0, calldatasize)
mstore8(callBytes, shr(24, methodId))
... | 5,394,823 |
pragma solidity ^0.4.24;
/**
* This utility library was forked from https://github.com/o0ragman0o/LibCLL
*/
library LinkedListLib {
uint256 constant NULL = 0;
uint256 constant HEAD = 0;
bool constant PREV = false;
bool constant NEXT = true;
struct LinkedList {
mapping (uint256 => mappin... | Approve `_operator` to operate all the Token of `_to` _operator The operator to be approved _to The owner of tokens to be operate _approved Approved or not/ | function approveOperatorTo(address _operator, address _to, bool _approved)
public
onlyOwnerOrAuthorizedContract {
operatorApprovals[_to][_operator] = _approved;
}
| 1,978,830 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.