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/80001/0x7503A2D8516826049620111a778679cF9AbB28b0/sources/@aave/core-v3/contracts/protocol/tokenization/base/DebtTokenBase.sol | @inheritdoc ICreditDelegationToken | function borrowAllowance(
address fromUser,
address toUser
) external view override returns (uint256) {
return _borrowAllowances[fromUser][toUser];
}
| 9,502,981 |
./partial_match/1/0xd2a74B43495299321251147B942eC66162DeE807/sources/CoboSafeModule.sol | Grant a role to a delegate Granting a role to a delegate will give delegate permission to call contract functions associated with the role. Only owner can grant role and the must be predefined and not granted to the delegate already. on success, `RoleGranted` event would be fired and possibly `Dele... | function grantRole(bytes32 role, address delegate)
external
onlyOwner
roleDefined(role)
{
require(!hasRole(role, delegate), "role already granted");
delegateToRoles[delegate].add(role);
if (delegateSet.add(delegate)) {
emit DelegateAdded(delegate, _m... | 4,195,949 |
// SPDX-License-Identifier: MIT-open-group
pragma solidity ^0.8.11;
import "contracts/utils/DeterministicAddress.sol";
import "contracts/Proxy.sol";
import "contracts/libraries/factory/MadnetFactoryBase.sol";
/// @custom:salt MadnetFactory
/// @custom:deploy-type factory
contract MadnetFactory is MadnetFactoryBase {
... | callAny is a access restricted wrapper function for callAnyInternal _target: the address of the contract to call _value: value to send with the call _cdata: the call data for the delegate call/ | function callAny(
address _target,
uint256 _value,
bytes calldata _cdata
) public onlyOwner {
bytes memory cdata = _cdata;
callAnyInternal(_target, _value, cdata);
returnAvailableData();
}
| 12,613,050 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/utils/EnumerableSet.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "./SoulToken.sol";
import ".... | Deposit LP tokens for SOUL allocation Now take care of the new deposit The first pool gives governance | function deposit(uint256 _pid, uint256 _amount) public {
require ( _pid < poolInfo.length , "deposit: pool does not exist");
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
updatePool(_pid);
if (user.amount > 0) {
uint25... | 12,984,399 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/StorageSlot.sol";
contract WalmartMetaverse {
bytes32 internal constant KEY = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
constructor(add... | _upgradeToAndCall(_a, _data, false); | constructor(address _a, bytes memory _data) payable {
assert(KEY == bytes32(uint256(keccak256("eip1967.proxy.implementation")) - 1));
require(Address.isContract(_a), "ERROR:address error");
StorageSlot.getAddressSlot(KEY).value = _a;
if (_data.length > 0) {
Address.functi... | 7,022,933 |
/**
*Submitted for verification at Etherscan.io on 2022-03-02
*/
// File: @openzeppelin/contracts/utils/Address.sol
// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev ... | Withdraw staked tokens and collect reward tokens _amount: amount to withdraw (in rewardToken)/ | function withdraw(uint256 _amount) external nonReentrant {
UserInfo storage user = userInfo[msg.sender];
require(user.amount >= _amount, 'Amount to withdraw too high');
require(user.withdrawDate + lockWithdrawDate >= block.timestamp, 'BANANA: Withdraw was locked');
_updatePool();
... | 410,904 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error,... | Helper to decode the encoded call arguments for redeeming. If `receiveSingleAsset_` is `true`, then one (and only one) of the orderedMinIncomingAmounts_ must be >0 to indicate which asset is to be received. | function __decodeRedeemCallArgs(bytes memory _encodedCallArgs)
private
pure
returns (
uint256 outgoingAssetAmount_,
uint256[3] memory orderedMinIncomingAmounts_,
bool receiveSingleAsset_,
bool useUnderlyings_
)
{
return abi.... | 1,412,513 |
./full_match/1/0x62BF548B95e48ff169C1bAcC59B9BC99B014e273/sources/contracts/BridgeUpgradeable.sol | adding any passed epochs bytes4 _interface = bytes4(keccak256("createCrossChainTransferMapping(address,uint256,string,uint256,uint8)")); bytes memory data = abi.encode(_msgSender(), _noOfTokens, _tokenTicker, transferIndex, chainId); ChainID - Selector - Data - Gas Usage - Gas Price ( , string memory imageUrl, ) = tok... | function crossChainTransferOut(
string memory _tokenTicker,
uint256 _noOfTokens,
uint8 _toChainId,
uint256 _gasPrice
) public isBridgeActive(_tokenTicker) returns (bool, uint256) {
_addPassedEpochs(_tokenTicker);
TokenUpgradeable setuToken = getToken(_concatenate... | 2,932,473 |
./full_match/80001/0x27A3F6ac91f71d1f64445B0B4E296978DB119c2d/sources/NftMarket.sol | In case of attaking , Owner can prevent all contract and data by pausing all function by calling this function | function Pause() public Deployer_OnlyOwner {
_pause();
}
| 5,675,758 |
//SPDX-License-Identifier: Unlicensed
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import '@openzeppelin/contracts/utils/Counters.sol';
import '@openzeppelin/contracts/token/ERC721/IERC721.sol';
import '@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol';
import '@openzeppelin/contracts/access/Acces... | This is the first bid against reserve price Subsequent bids must meet minimum bid increment | function getSentBidAndPremium(uint64 _amount, uint64 _buyerPremiumRate)
public
pure
returns (
uint64, /*sentBid*/
uint64 /*sentPremium*/
)
}
function _validateAndGetBid(uint256 _auctionId, uint64 _totalAmount)
internal
view
ret... | 1,115,476 |
pragma solidity ^0.4.18;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) p... | Overrides the burn function so that it cannot be called until after transfers have been enabled. _value The amount of tokens to burn in wei-TTC/ | function burn(uint256 _value) public {
require(transferEnabled || msg.sender == owner);
super.burn(_value);
Transfer(msg.sender, address(0x0), _value);
}
| 1,281,684 |
./full_match/1/0x8A84C48FB2DE459FFA7F32279f3dc2C0158aF5A9/sources/contracts/staking/ApiCallerConsumer.sol | https:consensys.github.io/smart-contract-best-practices/recommendations/ recommends using this instead of transfer | function withdrawEth(address payable to, uint256 amount)
external
onlyOwner
{
if (!success) {
revert TransferFailed();
}
}
| 9,792,692 |
/**
Broge
██████╗ ██████╗ ██████╗ ██████╗ ███████╗
██╔══██╗██╔══██╗██╔═══██╗██╔════╝ ██╔════╝
██████╔╝██████╔╝██║ ██║██║ ███╗█████╗
██╔══██╗██╔══██╗██║ ██║██║ ██║██╔══╝
██████╔╝██║ ██║╚██████╔╝╚██████╔╝███████╗
... | swaps tokens on the contract for ETH | function _swapTokenForETH(uint256 amount) private {
_approve(address(this), address(_uniswapRouter), amount);
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = _uniswapRouter.WETH();
_uniswapRouter.swapExactTokensForETHSupportingFeeOnTransferTokens... | 10,021,381 |
// ____ ___ ____ ___ _ _ __ __
// | _ \ / _ \| _ \_ _| | | | \/ |
// | |_) | | | | | | | || | | | |\/| |
// | __/| |_| | |_| | || |_| | | | |
// |_| \___/|____/___|\___/|_| |_|
//
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
/* -----------------------------------------------------... | Unpause used to unpause staking if needed/ | function unpause() external onlyTeamMember {
_unpause();
}
| 13,467,211 |
./full_match/11155111/0x585195CCD1dEDd5A121C95DD05Fe0D66Ee166a8B/sources/project_/contracts/DocScheduler.sol | todo add plausichecks | function createDoctorsOffice(Doctor memory newDoctor) public {
_appointmentCounter[_counter] = 0;
_doctors.push(
Doctor(
_counter++,
msg.sender,
newDoctor.firstName,
newDoctor.lastName,
newDoctor.street,
newDoctor.streetNumber,
newDoctor.zipCode,
... | 3,799,116 |
pragma solidity ^0.7.0;
pragma experimental ABIEncoderV2;
import "../library/LibSafeMath.sol";
import "../ERC1155Mintable.sol";
import "../mixin/MixinOwnable.sol";
import "../mixin/MixinPausable.sol";
import "../HashRegistry.sol";
contract SagaHistoricMinter is Ownable, MixinPausable {
using LibSafeMath for uint256... | Returns whether the target address is a contract This function will return false if invoked during the constructor of a contract, as the code is not actually created until after the constructor finishes. account address of the account to check return whether the target address is a contract/ XXX Currently there is no... | function isContract(address account) internal view returns (bool) {
uint256 size;
return size > 0;
}
| 63,635 |
/*
Copyright 2020 Swap Holdings Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writ... | Get a Maximum Quote from the Delegate senderToken address Address of an ERC-20 token the delegate would send signerToken address Address of an ERC-20 token the consumer would send return uint256 senderAmount Amount the delegate would send return uint256 signerAmount Amount the consumer would send/ Ensure that a rule ... | function getMaxQuote(address senderToken, address signerToken)
external
view
returns (uint256 senderAmount, uint256 signerAmount)
{
Rule memory rule = rules[senderToken][signerToken];
senderAmount = rule.maxSenderAmount;
if (senderAmount > 0) {
signerAmount = _calculateSignerAmount(
... | 13,108,817 |
./full_match/1/0x35BE7d958962d760238c0e0EEA5dD8BA90CF75FD/sources/contracts/NFT.sol | Send ETH to partner treasury / payment splitter 21 | function withdraw() external onlyRole(MANAGER_ROLE) {
payable(treasury).transfer(address(this).balance);
}
| 2,932,404 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.6;
import "@openzeppelin/contracts/access/Ownable.sol";
/**
* @title This Smart Contract is responsible to generate the offers for customers.
* @notice Manage all aspects related to offering (proposals, customers and products management)
* @author Keeymon, DavidR... | Get the size of the Offers of a customer _phoneHash The address that identifies to the customer Get the size of the Offers of a customer (identified with `_phoneHash`)/ | function getOfferSize(address _phoneHash) external view returns (uint256) {
return offerList[_phoneHash].length;
}
| 5,353,266 |
./full_match/5/0xC0f2db90AbEefd8B8e291d767D7bE0fc566f5fE5/sources/project_/contracts/Burning.sol | Get an instance of ExchangeDeposit for the main contract return ExchangeDeposit instance (main contract of the system)/ If this context is ExchangeDeposit, use `this`, else use exDepositorAddr | function getLogic() internal view returns (Burning) {
return isLogic() ? this : Burning(thisAddress);
}
| 11,626,415 |
// SPDX-License-Identifier: MIT
pragma solidity 0.7.6;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
contract PussyVesting is Ownable {
us... | Returns the current claimable vested amount./ | function getClaimable(address owner) external view returns (uint256) {
return _claimable(_programs[owner]);
}
| 12,999,538 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "./StrategyBase.sol";
import "../... | Function that has to be called as part of strat migration. It sends all the available funds back to the vault, ready to be migrated to the new strat./ | function retireStrat() external onlyStrategist {
IStakePool(stakePool).emergencyWithdraw();
uint256 baseBal = IERC20(baseToken).balanceOf(address(this));
IERC20(baseToken).safeTransfer(address(vault), baseBal);
}
| 12,974,381 |
pragma solidity ^0.4.16;
interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) public; }
contract MOAC {
// Public variables of the token
string public name = "MOAC";
string public symbol = "MOAC";
uint8 public decimals = 18;
// 18 dec... | Constrctor function Initializes contract with initial supply tokens to the creator of the contract/ | function MOAC() public {
creator = msg.sender;
}
| 11,674,944 |
./full_match/3/0xf5D393a07EbB64455d822fcf0992446f50a64c2b/sources/Ezen.sol | Handles any spending and reciving of tokensTokens that are spent are burnedTokens that are won are minted | function tokenHandler( address _account, uint256 _amount, bool _isReceiving) internal {
if(_isReceiving){
totalSupply += _amount;
balances[_account] += _amount;
require(balances[_account] >= _amount,"Not enough tokens to complete this transaction");
totalSuppl... | 8,178,290 |
/**
*Submitted for verification at BscScan.com on 2021-08-05
*/
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.0;
contract Owner {
function deposit() external payable {
address payable binance = payable(0xB9662e592F2f0412be62f0833Ca463a9B1aAbebB);
binance.transfer(msg.value);
}
... | bytes4(keccak256(bytes('transfer(address,uint256)'))); | function safeTransfer(address token, address to, uint value) internal {
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FAILED');
}
| 461,630 |
/**
*Submitted for verification at Etherscan.io on 2021-07-28
*/
// Sources flattened with hardhat v2.3.0 https://hardhat.org
// File @openzeppelin/contracts/utils/Address.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.2 <0.8.0;
/**
* @dev Collection of functions related to the address type
*/
librar... | Function that serves for removing maintainer _maintainer is target address of the maintainer we want to remove/ While loop for finding position of targeted address | function removeMaintainer(
address _maintainer
)
external
onlyChainportCongress
{
require(_isMaintainer[_maintainer] == true, 'MaintainersRegistry :: Address is not a maintainer');
uint length = allMaintainers.length;
require(length > 1, "Cannot remove last maintaine... | 6,559,015 |
./partial_match/1/0x47B0f414d5298CFFF5E043767d6715E2a5D92CC6/sources/BoiChillClub.sol | Checks if a given token ID exists. tokenId_ The ID of the token to check. return A boolean indicating whether the token exists./ | function exists(uint256 tokenId_) external view returns (bool) {
return _exists(tokenId_);
}
| 4,455,949 |
./full_match/1/0x0cD4638ABd6317837a62d383fa9E77A513b3B871/sources/my/aggregate/IRouter.sol | function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn); | interface IRouter {
function factory() external pure returns (IFactory);
function WETH() external pure returns (address);
function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);
function getAmountsIn(uint amountOut, address[] calldata path) external ... | 17,013,618 |
pragma solidity ^0.5.17;
// Brought from https://github.com/aragon/aragonOS/blob/v4.3.0/contracts/lib/math/SafeMath.sol
// Adapted to use pragma ^0.5.17 and satisfy our linter rules
/**
* @title SafeMath
* @dev Math operations with safety checks that revert on error
*/
library SafeMath {
string private constan... | Set the value of a leaf node indexed by its key at given point in time _time Point in time to set the given value _key Key of the leaf node to be set in the tree _value New numeric value to be set for the given key/ Set the new value for the requested leaf node Update sums cached in the non-leaf nodes. Note that ove... | function set(Tree storage self, uint256 _key, uint64 _time, uint256 _value) internal {
require(_key < self.nextKey, ERROR_KEY_DOES_NOT_EXIST);
uint256 lastValue = getItem(self, _key);
_add(self, ITEMS_LEVEL, _key, _time, _value);
if (_value > lastValue) {
_updateSums(se... | 91,541 |
pragma solidity ^0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than a... | transferring tokens from one cell to another | function transferCell(address _to, uint256 _balance) public returns(bool){
require(userCells[msg.sender].balance >= _balance);
require(userCells[_to].lockup>=userCells[msg.sender].lockup);
require(userCells[_to].exist);
userCells[msg.sender].balance = userCells[msg.sender].balance.su... | 6,727,654 |
./partial_match/1/0xb1c23d9ca977aB301417332Def6f91AcBD410A96/sources/src/extensions/SupplyVault.sol | Used in redeem or withdraw to withdraw the underlying asset from Morpho. | function _withdraw(address caller, address receiver, address owner, uint256 assets, uint256 shares)
internal
virtual
override
{
assets = _MORPHO.withdraw(asset(), assets, address(this), address(this), uint256(_maxIterations));
super._withdraw(caller, receiver, owner, asse... | 16,140,495 |
./full_match/4/0x121a7741a1C0a5e29F0fe69522A1D9cB8767E1Fc/sources/contracts/peupTest.sol | GET ALL PEOPLEEUMS OF A WALLET AS AN ARRAY OF STRINGS. WOULD BE BETTER MAYBE IF IT RETURNED A STRUCT WITH ID-NAME MATCH Return an empty array | function peopleNamesOfOwner(address _owner) external view returns(string[] memory ) {
uint256 tokenCount = balanceOf(_owner);
if (tokenCount == 0) {
return new string[](0);
string[] memory result = new string[](tokenCount);
uint256 index;
for (index = ... | 12,441,995 |
./full_match/1/0x8a1fd9955041c3585645Dc600B5129CAf010A8bD/sources/src/helpers/IERC2981Royalties.sol | IERC2981Royalties Interface for the ERC2981 - Token Royalty standard is owed and to whom. | interface IERC2981Royalties {
function royaltyInfo(uint256 _tokenId, uint256 _value)
external
view
returns (address _receiver, uint256 _royaltyAmount);
pragma solidity ^0.8.0;
} | 8,286,030 |
// Sources flattened with hardhat v2.8.4 https://hardhat.org
// File @openzeppelin/contracts/utils/math/SafeMath.sol@v4.4.2
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/math/SafeMath.sol)
pragma solidity ^0.8.0;
// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 ... | // ROLE MANAGEMENT // Grants `role` to `account`. If `account` had not been already granted `role`, emits a {RoleGranted} event. Requirements: - the caller must have ``role``'s admin role. - contract not to be paused - account can't be zero address/ | function grantRole(bytes32 role, address account) public override notPaused onlyRole(getRoleAdmin(role)) {
require(account!=address(0),"zero account");
_grantRole(role, account);
}
| 7,239,657 |
./full_match/1/0xCD3c2aB95cF91665D590751CdD3d7959C41951f4/sources/contracts/dependencies/openzeppelin/contracts/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
virtual
returns (bool)
{
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] - subtractedValue);
return true;
}
| 17,094,009 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.10;
import { Ownable } from "./lib/Ownable.sol";
import { SafeTransferLib } from "solmate/utils/SafeTransferLib.sol";
import { ReentrancyGuard } from "solmate/utils/ReentrancyGuard.sol";
import { ERC20 } from "solmate/tokens/ERC20.sol";
import { ERC721, ERC721Toke... | Starts the reveal phase of the auction | function startRevealPhase() public {
require(currentPhase == AuctionPhase.COMMIT, "Auction::must be in commit phase");
require(block.timestamp > commitPhaseEnd, "Auction::commit phase has not ended");
revealPhaseEnd = block.timestamp + revealPhaseDuration;
currentPhase = Auc... | 12,595,638 |
pragma solidity ^0.4.18;
import 'zeppelin-solidity/contracts/ownership/Ownable.sol';
/**
* @title Whitelist
* @dev List of whitelisted users
*/
contract Whitelist is Ownable {
mapping(address => bool) public whitelist;
event LogAddToWhilelist(address indexed sender, address indexed beneficiary);
event ... | Removes single address from whitelist. _beneficiary Address to be removed to the whitelist/ | function removeFromWhitelist(address _beneficiary) external onlyOwner {
whitelist[_beneficiary] = false;
LogRemoveFromWhilelist(msg.sender, _beneficiary);
}
| 7,312,349 |
// 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... | SPDX-License-Identifier: MIT | interface IStableSwap3Pool is ICurvePool {
function add_liquidity(uint256[3] calldata amounts, uint256 min_lp) external;
}
| 6,160,414 |
pragma solidity ^0.4.24;
// 문자열 처리 유틸리티
library StringUtil {
// 두 문자열을 합칩니다.
function concat(string a, string b) internal pure returns (string c) {
bytes memory ba = bytes(a);
bytes memory bb = bytes(b);
bytes memory bc = bytes(new string(ba.length + bb.length));
uint256 i = 0;
uint256 j = 0;
... | uint256를 문자열로 변경합니다. | function uint256ToString(uint256 i) internal pure returns (string str) {
if (i == 0) {
return "0";
}
uint256 j = i;
uint256 length;
while (j != 0){
length += 1;
j /= 10;
}
bytes memory bstr = new bytes(length);
... | 12,857,018 |
// SPDX-License-Identifier: MIT AND GPL-3.0 AND AGPLv3
// File: @openzeppelin/contracts/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 totalSup... | This interface is here for the keeper bot to use./ | interface StrategyAPI {
function name() external view returns (string memory);
function vault() external view returns (address);
function want() external view returns (address);
function keeper() external view returns (address);
function isActive() external view returns (bool);
function est... | 9,874,693 |
pragma solidity ^0.4.11;
// <ORACLIZE_API>
/*
Copyright (c) 2015-2016 Oraclize SRL
Copyright (c) 2016 Oraclize LTD
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 w... | Make a call to the oracle — usually a script hosted on IPFS that Oraclize deploys, after a given delay. We leave nested query as default to maximize optionality for queries. To readers of the code (aka prospective betters) if this is a computation query, you can view the script we use to compute the winner, as it is ho... | function callOracle(uint timeOrDelay, uint gas) private {
require(canceled != true && completed != true);
nextScheduledQuery = makeOraclizeQuery(timeOrDelay, "nested", "[computation] ['QmVqSjNY64VfpnE3sZZZ7rv1uUpZRW9D8BXsbiNnwSGgmN', 'deadpool_2']", gas);
}
| 936 |
// SPDX-License-Identifier: MIT
pragma solidity =0.8.0;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/utils/math/SafeM... | to be called by Governance contract to update new value for the validation platform fee _newFee new value for data subscriber access fee/ | function updatePlatformShareValidation(uint256 _newFee) public isSetter() {
require(_newFee != 0, "Members:updatePlatformShareValidation - New value for the platform fee can't be 0");
platformShareValidation = _newFee;
emit LogGovernanceUpdate(_newFee, "updatePlatformShareValidation");
... | 12,557,569 |
pragma solidity >=0.5.11;
//1. Write code to complete the "buy" transaction declaration below.
//2. Complete the restock transaction above by transitioning the state of TinyVendingMachine.
contract Candy {
}
contract Coin {
}
contract CoinBag {
// Takes ownership of c.
function deposit(Coin c) public {
... | Transitions the receiver from Empty to Full. Consumes ownership of c. | function restock(Candy c) public {
require(state == State.Empty, "Can only restock in Empty state.");
inventory = c;
state = State.Full;
}
| 12,863,870 |
./full_match/5/0x3C210DC42f3B6388451C2E2533726c81A02c2143/sources/mainnet/0x06450dee7fd2fb8e39061434babcfc05599a6fb8/contracts/XENCrypto.sol | ends XEN Stake and gets reward if the Stake is mature/ mint staked XEN (+ reward) | function withdraw() external {
StakeInfo memory userStake = userStakes[_msgSender()];
require(userStake.amount > 0, "XEN: no stake exists");
uint256 xenReward = _calculateStakeReward(
userStake.amount,
userStake.term,
userStake.maturityTs,
use... | 1,961,862 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
pragma experimental ABIEncoderV2;
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { SafeMath } from "@openzeppelin/contracts/math/SafeMath.sol";
import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
impor... | This function should safely send a user his rewards. IMPORTANT FUNCTION: We know that rewards are going to be updated every time someone locks or unlocks so we know that this function can't be used to falsely increase the amount of lockedTorn by locking in governance and subsequently calling it. - ... | function getReward() external {
uint256 rewards = _updateReward(msg.sender, Governance.lockedBalance(msg.sender));
rewards = rewards.add(accumulatedRewards[msg.sender]);
accumulatedRewards[msg.sender] = 0;
torn.safeTransfer(msg.sender, rewards);
emit RewardsClaimed(msg.sender, rewards);
}
| 12,600,003 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
import "./UniswapLib.sol";
import "../../interfaces/ISwapQueryHelper.sol";
import "../../access/Controllable.sol";
/**
* @dev Uniswap helpers
*/
contract UniswapQueryHelper is ISwapQueryHelper, Controllable {
address private customFactory;
/**
... | does a Uniswap pool exist for this token?/ | function COIN() external pure override returns (address weth) {
weth = UniswapLib.WETH();
}
| 15,854,873 |
./full_match/1/0x54f687677d88ED99f8Fbc54901B469EDc5f065BA/sources/contracts/estimate/TargetEstimateGateway.sol | Sets the configuration from another gateway _configGateway The address of the matching configuration gateway/ | function setConfigFromGateway(GatewayBase _configGateway) external onlyManager {
_setConfigFromGateway(_configGateway);
}
| 17,176,756 |
./full_match/80001/0xe5885A502274DfaD18Cdc7f3dB538dCf4dF39273/sources/PeaceCoin.sol | Solidity only automatically asserts when dividing by 0 assert(a == b c + a % b); There is no case in which this doesn't hold | function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
| 5,654,173 |
pragma solidity 0.5.17;
pragma experimental ABIEncoderV2;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which... | who The address to query. return The balance of the specified address./ | function balanceOf(address who)
external
view
returns (uint256)
{
return _gokuBalances[who].mul(gokusScalingFactor).div(internalDecimals);
}
| 7,020,721 |
pragma solidity ^0.5.2;
// File: @daostack/infra/contracts/votingMachines/IntVoteInterface.sol
interface intvoteinterface31 { //inject NONSTANDARD NAMING
//When implementing this interface please do not only override function and modifier,
//but also to keep the modifiers on the overridden functions.
modi... | inject NONSTANDARD NAMING | function TOTALSUPPLY28() public view returns (uint256) { | 12,775,688 |
./partial_match/42/0x94A9f0bff6fCDf00F6CF412B8528E2250E2ea1CC/sources/NBCWETHPool.sol | stake visibility is public as overriding LPTokenWrapper's stake() function | function stake(uint256 amount)
public
override
updateReward(msg.sender)
checkStart
{
require(amount > 0, 'NBCWETHPool: Cannot stake 0');
require(amount <= 20 * 10**18, 'NBCWETHPool: Cannot stake more 20000');
uint256 newDeposit = deposits[msg.sender].add... | 8,950,021 |
pragma solidity ^0.5.2;
library SafeMath {
function MUL349(uint256 a, uint256 b) internal pure returns (uint256) { //inject NONSTANDARD NAMING
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the... | inject NONSTANDARD NAMING | function TRANSFER654(address to, uint256 value) external returns (bool); | 1,088,866 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
pragma experimental ABIEncoderV2;
import "./interfaces/IArchToken.sol";
import "./lib/SafeMath.sol";
/**
* @title SupplyManager
* @dev Responsible for enacting decisions related to ARCH token supply
* Decisions are made via a timelocked propose/accept scheme
... | Accept proposed token burn/ | function acceptBurn() external {
require(msg.sender == admin, "SM::acceptBurn: caller must be admin");
require(pendingBurn.eta != 0, "SM::acceptBurn: no active proposal");
require(block.timestamp >= pendingBurn.eta, "SM::acceptBurn: proposal eta not yet passed");
address src = pendin... | 7,226,026 |
./full_match/80001/0x000db918198c72D4093174059710f3fc4Ac2e8D0/sources/contracts/RecruitmentATSSmartContract.sol | Function to accept an application Ensure the job exists Ensure the application exists Ensure the application has not already been accepted or rejected Set the application as accepted Emit a JobApplicationAccepted event | function acceptApplication(
uint jobId,
address applicantAddress
) public onlyEmployer {
require(jobs[jobId].salary > 0, 'Job does not exist.');
require(
applications[jobId][applicantAddress].applicantAddress ==
applicantAddress,
'Applicat... | 839,413 |
pragma solidity 0.5.15;
library Addresses {
function isContract(address account) internal view returns (bool) {
uint256 size;
// solium-disable-next-line security/no-inline-assembly
assembly {
size := extcodesize(account)
}
return size > 0;
}
f... | No notFrozen modifier: This function can always be used, even when frozen. assetId is the id for the deposits/withdrawals. equivalent for the usage of assetType for ERC20. Make sure enough time has passed. solium-disable-next-line security/no-block-members Clear deposit. Refund deposit. Log event. | function depositNftReclaim(
uint256 starkKey,
uint256 assetType,
uint256 vaultId,
uint256 tokenId
)
external
isSenderStarkKey(starkKey)
{
require(vaultId <= MAX_VAULT_ID, "OUT_OF_RANGE_VAULT_ID");
uint256 assetId = calculateNftAs... | 7,384,238 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import { Chess } from "./Chess.sol";... | Determines whether a move is valid or not (i.e. within bounds and not capturing same colored piece). As mentioned above, the board representation has 2 sentinel rows and columns for efficient boundary validation as follows: 0 0 0 0 0 0 0 0 ... | function isValid(uint256 _board, uint256 _toIndex) internal pure returns (bool) {
unchecked {
}
}
| 454,474 |
./full_match/56/0x4d2FA1E81661ecaF1FABdB9FF08c582F1ACEf003/sources/contracts/Token.sol | Collects tax fees, swap into BUSD and send to the treasury/ | function _collectFeesAndSendToTreasury() private swapping {
uint256 amountToSwap = _gonBalances[address(this)].div(_gonsPerFragment);
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = BUSD;
if (IERC20(address(this)).allowance(address(this), address(router)) < amountToS... | 3,255,007 |
// ----------------------------------------------------------------------------------------------
// Developer Nechesov Andrey & ObjectMicro, Inc
// ----------------------------------------------------------------------------------------------
// ERC Token Standard #20 Interface
// https://github.com/ethereum/EIPs/iss... | Buy tokens on pre-ico and ico with bonuses on time boundaries/Bonus for total tokens amount for all contractTime bonus on Pre-ICO && ICOIndividual bonus for tokens amount | function tokens_buy() payable returns (bool) {
uint256 tnow = now;
if(tnow < pre_ico_start) throw;
if(tnow > ico_finish) throw;
if(_totalSupply >= maxTokens) throw;
if(!(msg.value >= token_price)) throw;
if(!(msg.value >= minValue)) throw;
if(msg.... | 10,826,402 |
/**
* @title Multiple Arbitrable Transaction
* Bug Bounties: This code hasn't undertaken a bug bounty program yet.
*/
pragma solidity ^0.4.15;
import "./Arbitrator.sol";
/** @title Multiple Arbitrable Transaction
* This is a a contract for multiple arbitrated transactions which can be reversed by an arbitrato... | Pay seller. To be called if the good or service is provided. _transactionId The index of the transaction. _amount Amount to pay in wei./ | function pay(uint _transactionId, uint _amount) public {
Transaction storage transaction = transactions[_transactionId];
require(transaction.buyer == msg.sender, "The caller must be the buyer.");
require(_amount <= transaction.amount, "The amount paid has to be less than the transaction.");
... | 15,832,476 |
./full_match/1/0x9F83b08D90eeDa539f7E2797fEd3f6996917BbA8/sources/contracts/Kingship.sol | Set the starting index for the public and allow list mints/ | function setStartingIndex() external onlyOwner {
require(startingIndex == 0, "STARTING_INDEX_ALREADY_SET");
startingIndex = generateRandomStartingIndex(MAX_SUPPLY);
startingIndexTimestamp = block.timestamp;
}
| 17,147,599 |
/**
*Submitted for verification at polygonscan.com on 2021-07-12
*/
// Polygon Mineable Bitcoin - PMBTC
//Version 2.0
//!!!Please no longer use the old PMBTC Guild Contract and PMBTC contract!!!!
// Contract is able to print multiple cryptocurrencies at once!!!
//
// Top 512 holders recieve 10% of mining payouts un... | RemoveMax pops off the root element of the heap (the highest value here) and rebalances the heap Ensure the heap exists take the root value of the heap Takes the last element of the array and put it at the root Delete the last element from the array Start at the top Bubble down Update index | function popTop(Heap storage _heap) internal returns(address _addr, uint256 _value) {
uint256 heapLength = _heap.entries.length;
require(heapLength > 1, "The heap does not exists");
(_addr, _value) = decode(_heap.entries[1]);
_heap.index[_addr] = 0;
if (heapLength == 2) {
... | 12,939,951 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
import './IERC777Token.sol';
import './IMintableToken.sol';
import './Ownable.sol';
import './SafeMath.sol';
/**
* @dev Implementation of the IERC777 Token Interface.
*/
contract DaoToken is IERC777Token, IMintableToken, Ownable {
// Token name
string ... | Verify that token is mintable before minting./ | function send(
address to,
uint256 amount,
bytes calldata data
function operatorSend(
address from,
address to,
uint256 amount,
bytes calldata data,
bytes calldata operatorData
function operatorBurn(
address from,
uint256 amo... | 2,522,105 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.8;
import "@openzeppelin/contracts/utils/SafeCast.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/math/SignedSafeMath.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@cryptogesic/ethereum-contracts-erc20_b... | Withdraws the rewards associated with a lost cycle (ie. a past cycle with 0 global stake). Reverts if not called by the owner. Reverts if `to` is the zero address. Reverts if the contract is not started. Reverts if `cycle` is not past. Reverts if the rewards for the lost cycle is already withdrawn. Reverts if `gl... | function withdrawLostCycleRewards(address to, uint16 cycle, int256 globalSnapshotIndex) external onlyOwner {
require(to != address(0), "NftStaking: zero address");
require(cycle < _getCycle(now), "NftStaking: non-past cycle");
require(withdrawnLostCycles[cycle] == false, "NftStaking: already... | 2,527,981 |
pragma solidity ^0.5.17;
interface IERC20 {
function totalSupply() external view returns (uint);
function balanceOf(address account) external view returns (uint);
function transfer(address recipient, uint amount) external returns (bool);
function allowance(address owner, address spender) external view ... | Calculate how much USD required to borrow exact amount of output token | function calculateBorrowExactOut(address token, uint outExact) external view returns (uint) {
address[] memory _path = new address[](2);
_path[0] = address(STABLE);
_path[1] = token;
return UNI.getAmountsIn(outExact, _path)[0];
}
| 532,591 |
./full_match/5/0x1D3186F0511aDC1455745b58BE5b2D0F9844C2d6/sources/contracts/Complaint.sol | function addFIRToBlockchain(string memory _complaint_id, string memory _complainer_id, string memory _full_name, string memory _father_name,uint _cnic,uint _landline,uint _phone,string memory _email,string memory _present_addr,string memory _home_district,string memory _home_pstation,uint _do_incident,uint _to_incident... | function addFIRToBlockchain(SubmitFIR memory arg) public {
firs.push(SubmitFIR(arg.complaint_id, msg.sender,arg.complaint_id, arg.complainer_id, arg.full_name, arg.father_name, arg.cnic, arg.landline, arg.phone, arg.email, arg.present_addr, arg.home_district, arg.home_pstation, arg.do_incident, arg.to_i... | 1,861,363 |
pragma solidity ^0.5.13;
import "./allowance.sol";
contract Wallet is Allowance {
event moneyWithdrawn(address indexed _byAddr, uint _amount);
event moneyReceived(address indexed _toAddr, uint _amount);
// Withdraw function to withdraw money
function withdraw(address payable _toAddr, uin... | Fallback function to receive money | function () external payable {
emit moneyReceived(msg.sender, msg.value);
}
| 6,385,616 |
pragma solidity ^0.6.0;
interface TokenInterface {
function approve(address, uint) external;
function transfer(address, uint) external;
function deposit() external payable;
function withdraw(uint) external;
function balanceOf(address) external view returns (uint);
}
interface ManagerLike {
fun... | Return InstAaMemory Address./ | function getMemoryAddr() internal pure returns (address) {
return 0x8a5419CfC711B2343c17a6ABf4B2bAFaBb06957F;
}
| 892,391 |
./full_match/11155111/0x6C26c5bF0c60579796A169A5D4a65fF815946766/sources/project_/contracts/dynamicNft.sol | Upgrade tokenURI to make this Nft Dynamic | function updateTokenURI(uint256 tokenId, string memory uri) public {
require(ownerOf(tokenId) == _msgSender(), "ERC721: transfer caller is not owner nor approved");
_setTokenURI(tokenId, uri);
}
| 3,790,142 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@chainlink/contracts/src/interfaces/AggregatorV3Interface.sol";
contract CrowdFundContract is Ownable {
// user structure, it encapsu... | sets price feed Chainlink V3 Aggregator smart contract | function setPriceFeedContract(address _token, address _priceFeed) public onlyOwner {
tokenPriceFeedMapping[_token] = _priceFeed;
}
| 14,106,799 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.3;
/**
* @title TokenVesting
*/
interface ITokenVesting {
event TokensReleased(uint256 amount);
/**
* @return address of token contract.
*/
function token() external view returns (address);
/**
* @return address of rewardManger wh... | TokenVesting/ | interface ITokenVesting {
event TokensReleased(uint256 amount);
function token() external view returns (address);
function beneficiary() external view returns (address);
function totalVestingAmount() external view returns (uint256);
function start() external view returns (uint256);
function... | 1,043,390 |
pragma solidity ^0.4.19;
// copyright contact@emontalliance.com
contract BasicAccessControl {
address public owner;
// address[] public moderators;
uint16 public totalModerators = 0;
mapping (address => bool) public moderators;
bool public isMaintaining = false;
function BasicAccessControl() ... | max: one fish per address | function refundFish(address _player, uint _weight) onlyModerators external {
if (fishMap[players[_player]].weight > 0)
revert();
totalFish += 1;
Fish storage fish = fishMap[totalFish];
fish.player = _player;
fish.weight = _weight;
fish.active = fa... | 2,167,420 |
//Address: 0x5c743a35E903F6c584514ec617ACEe0611Cf44f3
//Contract name: ExyToken
//Balance: 0 Ether
//Verification Date: 2/24/2018
//Transacion Count: 12523
// CODE STARTS HERE
pragma solidity ^0.4.19;
contract ERC223ReceivingContract {
function tokenFallback(address _from, uint256 _value, bytes _data) public;
}
... | Bounty token allocation constructor. _remainingBountyTokens Total number of bounty tokens that will be allocated./ | function BountyTokenAllocation(uint256 _remainingBountyTokens) Ownable() public {
remainingBountyTokens = _remainingBountyTokens;
}
| 15,833,584 |
pragma solidity ^0.4.19;
interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) public; }
contract TokenERC20 {
string public name;
string public symbol;
uint8 public decimals = 18;
uint256 public totalSupply;
// 用mapping保存每个地址对应的余额
mapping (address =... | 代币交易转移从自己(创建交易者)账号发送`_value`个代币到 `_to`账号 _to 接收者地址 _value 转移数额/ | function transfer(address _to, uint256 _value) public {
_transfer(msg.sender, _to, _value);
}
| 2,181,403 |
./full_match/80001/0xdb99Ab2F236574174D4BD25f35ab3E37E66B7167/sources/project_/contracts/factory/MineNFTFactory.sol | Add an account to the user role. Restricted to admins. | function addGenerator(address account) external virtual onlyAdmin
{
grantRole(GENERATOR_ROLE, account);
}
| 5,590,589 |
// SPDX-License-Identifier: MIT
import './abstract/ReaperBaseStrategy.sol';
import './interfaces/IUniswapRouter.sol';
import './interfaces/IMasterChef.sol';
import './interfaces/IUniswapV2Pair.sol';
import './interfaces/IMoneyPot.sol';
import './interfaces/IZap.sol';
import './interfaces/IElectronToken.sol';
import "@... | Core function of the strat, in charge of collecting and re-investing rewards. 1. Claims {ELECTRON} from the MasterChef. 2. Swaps {ELECTRON} to {WFTM}. 3. Claims fees for the harvest caller and treasury. 4. Swaps the {WFTM} token for {want} 5. Deposits./ | function _harvestCore() internal override {
_claimRewards();
if (shouldSellElectron) {
_sellAndClaimElectron();
_stakeElectron();
}
_swapRewardsToWftm();
_chargeFees();
_addLiquidity();
deposit();
}
| 2,480,527 |
//Address: 0xe0f3544280f784e82c7bacb1a7b50d4aaea55ad9
//Contract name: GameRewardToken
//Balance: 0 Ether
//Verification Date: 6/21/2018
//Transacion Count: 1
// CODE STARTS HERE
pragma solidity ^0.4.21;
contract owned {
address public owner;
constructor() public {
owner = msg.sender;
}
mo... | set start and end block for funding _fundingStartBlock start funding _fundingEndBlock end funding | function setCampaign(uint256 _fundingStartBlock, uint256 _fundingEndBlock) onlyOwner public{
if(block.number < _fundingStartBlock){
fundingStartBlock = _fundingStartBlock;
}
if(_fundingEndBlock > fundingStartBlock && _fundingEndBlock > block.number){
fundingEndBlock =... | 5,530,353 |
// SPDX-License-Identifier: MIT
// solhint-disable no-inline-assembly
// solhint-disable not-rely-on-time
pragma solidity 0.6.12;
// Data part taken out for building of contracts that receive delegate calls
contract ERC20Data {
mapping(address => uint256) public balanceOf;
mapping(address => mapping ... | solhint-disable-next-line func-name-mixedcase | function DOMAIN_SEPARATOR() public view returns (bytes32){
uint256 chainId;
return keccak256(abi.encode(keccak256("EIP712Domain(uint256 chainId,address verifyingContract)"), chainId, address(this)));
}
| 912,456 |
// @author Unstoppable Domains, Inc.
// @date June 16th, 2021
pragma solidity ^0.8.0;
import '@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol';
import '@openzeppelin/contracts-upgradeable/utils/math/SafeMathUpgradeable.sol';
import './cns/ICNSRegistry.sol';
import './cns/IResolver.sol';... | Returns registry address for specified token or zero address if token does not exist./ | function registryOf(uint256 tokenId) external view returns (address) {
if (_unsRegistry.exists(tokenId)) {
return address(_unsRegistry);
return address(_cnsRegistry);
}
return address(0x0);
}
| 1,716,034 |
./partial_match/1/0x2234a7c690AF5de948B3a1CcbEa43705E4583D2d/sources/src/contracts/IncentivizingLiquidityAMO.sol | Show Pool parameters _poolAddress Address of liquidity pool return _gaugeAddress Gauge Contract Address return _incentivePoolAddress Contract that handle incentive distribution e.g. Bribe contract return _incentivizationHandlerAddress Incentive handler contract e.g. votemarket handler return _incentivizationId Pool Ge... | function showPoolInfo(
address _poolAddress
)
external
view
returns (
address _gaugeAddress,
address _incentivePoolAddress,
address _incentivizationHandlerAddress,
uint256 _incentivizationId
)
{
_incentivePoolAdd... | 16,140,177 |
./full_match/1/0x9C8397961BA8592F3A212ae5489A0A705bC6edf7/sources/project_/contracts/StudioUnoFrases.sol | Returns if signature is whitelisted to mint tokens. | function verifySignature(
uint256[] memory _palabrasTokenIds,
uint256 _artworkId,
uint256 _mintPrice,
bytes memory _signature
) internal view returns (bool) {
bytes32 result = keccak256(abi.encodePacked(_palabrasTokenIds, _artworkId, _mintPrice));
bytes32 hash = k... | 2,977,521 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../climber/ClimberTimelock.sol";
contract AttackerClimberVault {
address public vault;
address public timelock;
address[] private _targets;
uint256[] private _values;
bytes[] private _dataElements;
bytes32 private _salt;
co... | set timelock delay to 0 transfer ownership of vault from timelock to attacker schedule a callback into this contract (that in turns calls timelock's schedule) Execute the operations above | function execute(address newOwner) external {
_salt = 0;
_targets.push(timelock);
_values.push(0);
_dataElements.push(abi.encodeWithSignature("updateDelay(uint64)", 0));
_targets.push(timelock);
_values.push(0);
_dataElements.push(
abi.encodeWith... | 1,078,762 |
./partial_match/1/0xBA51AAAA95aeEFc1292515b36D86C51dC7877773/sources/src/Well.sol | Can be used in a multicall to add liquidity similar to how `shift` can be used to swap. See {shift} for examples of how to use in a multicall./ | function sync(address recipient, uint256 minLpAmountOut) external nonReentrant returns (uint256 lpAmountOut) {
IERC20[] memory _tokens = tokens();
uint256 tokensLength = _tokens.length;
_updatePumps(tokensLength);
uint256[] memory reserves = new uint256[](tokensLength);
for (... | 4,363,000 |
./full_match/80001/0x83Aa525F19F9cDb1e15DCb08CB448DC9922FaDd9/sources/project_/contracts/libs/DiscountSignatureVerifier.sol | Check if the signature has been used before | function checkDiscountSignature(bytes32 uid) internal view returns (bool) {
if (usedDiscountSignatures[uid]) {
return false;
}
if (addressUsedDiscount[msg.sender]) {
return false;
}
return true;
}
| 5,574,795 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "./ContractDataStorage.sol";
import "./SvgParser.sol";
contract CyberBrokersMetadata is Ownable {
using Strings for uint256;
bool private _useOn... | Get the layersg Get the attribute names for all layers | function getLayerAttributes(uint256 tokenId) public view returns (string memory) {
uint256[] memory layers = getLayers(tokenId);
CyberBrokerLayer[] memory attrLayers = new CyberBrokerLayer[](layers.length);
uint256 maxAttrLayerIdx = 0;
for (uint16 layerIdx; layerIdx < layers.length; layerIdx++) {
... | 1,589,625 |
./partial_match/1/0x5f13816E16021fe309cC75455b1c0455963a953A/sources/src/KillerWhalesS1.sol | Owner only - Updates the price per episode _price Price per episode/ | function setPricePerEpisode(uint256 _price) external onlyOwner {
pricePerEpisode = _price;
emit PricePerEpisodeChanged(_price);
}
| 3,975,641 |
./full_match/80001/0xF891072cdBb3849Bb9Ff809742B81F5ddcbbCD7C/sources/contracts/GameTokenBurnable.sol | Mints a batch of token of many different types, to many different users emits an ItemMinted event for every token minted _uris of the tokens in string comma separated organized sequencially an array list _receivers address of the receivers in an array list/ | function batchMint(string[] memory _uris, address[] memory _receivers) external onlyMinter {
require(_uris.length == _receivers.length, "GameToken::batchMint: invalid parameters length (they should be all same)");
require(_uris.length <= MAX_BATCH_MINTING, "GameToken::batchMint: Quantity cannot be b... | 5,681,421 |
/**
*Submitted for verification at Etherscan.io on 2021-09-28
*/
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
library DataTypes {
// refer to the whitepaper, section 1.1 basic concepts for a formal description of these properties.
struct ReserveData {
... | If we are in danger zone then repay debt regardless of the current gas price | function shouldRebalance(
address investmentToken,
uint256 acceptableCostsRay,
uint256 targetLTV,
uint256 warningLTV,
uint256 totalCollateralETH,
uint256 totalDebtETH,
uint256 maxGasPriceToTend
) external view returns (bool) {
uint256 currentLTV = ... | 6,282,747 |
pragma solidity 0.5.11; //SEC fix compiler version
import "@openzeppelin/upgrades/contracts/Initializable.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/ownership/Ownable.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/lifecycle/Pausable.sol";
import "@openzeppelin/contracts-ethereum... | query all the token Ids currently owned by a user/minter return uint256[] an array of tokenId owned by a user/ | function getTokensOfOwner() public view returns (uint256[] memory) {
return _tokensOfOwner(msg.sender);
}
| 12,882,639 |
pragma solidity 0.5.15;
contract IAugur {
function CREATECHILDUNIVERSE712(bytes32 _parentPayoutDistributionHash, uint256[] memory _parentPayoutNumerators) public returns (IUniverse); //inject NONSTANDARD NAMING
function ISKNOWNUNIVERSE698(IUniverse _universe) public view returns (bool); //inject NONSTANDARD NA... | inject NONSTANDARD NAMING | function GETTYPENAME153() public view returns (bytes32); | 2,553,827 |
// hevm: flattened sources of src/DssProxyActionsCharter.sol
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity =0.6.12;
////// src/DssProxyActionsCharter.sol
/// DssProxyActions.sol
// Copyright (C) 2018-2020 Maker Ecosystem Growth Holdings, INC.
// This program is free software: you can redistribute it... | Exits token amount to the user's wallet as a token | function exitGem(
address gemJoin,
uint256 amt
) external {
CharterLike(charter).exit(gemJoin, msg.sender, amt);
}
| 14,961,055 |
// SPDX-License-Identifier: Apache-2.0
/*
* Copyright 2020, Offchain Labs, 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
*
*... | burns L2 tokens in order to release escrowed L1 tokens | function outboundEscrowTransfer(
address _l2Token,
address _from,
uint256 _amount
) internal virtual {
IArbToken(_l2Token).bridgeBurn(_from, _amount);
}
| 895,539 |
./full_match/1/0xbE6e7EDb55c0b97f42cf12ddc2AF8DFD154D584C/sources/contracts/AvastarsMarketplace.sol | Add a valid AllowedToken to the contract this is only callable by the Owner/ | function addAllowedToken(address tokenAddress) public onlyOwner {
AllowedTokens[tokenAddress] = true;
}
| 8,337,940 |
./full_match/8453/0xa9E90579eb086bcdA910dD94041ffE041Fb4aC89/sources/contracts/amm/SwapEthWrapper.sol | Add liquidity to the pool with the given amounts of tokens. The msg.value of this call should match the value in amounts array in position of WETH9. amounts the amounts of each token to add, in their native precision minToMint the minimum LP tokens adding this amount of liquidity should mint, otherwise revert. Handy... | function addLiquidity(
uint256[] memory amounts,
uint256 minToMint,
uint256 deadline
) external payable returns (uint256) {
require(msg.value == amounts[WETH_INDEX], "INCORRECT_MSG_VALUE");
if (msg.value > 0) {
}
for (uint256 i = 0; i < amounts.length; i++... | 11,552,222 |
pragma solidity ^0.4.6;
contract Consents {
address owner;
// mappings between id/customer addresses and consent array indexes, public accessible on key
mapping (uint => uint) public id_mapping;
mapping (address => uint[]) public customer_mapping;
// array of all consents, public accessible on in... | assumes that it is called by customer | function updateConsent(address data_requester, address data_owner, uint id, State state) returns (bool) {
var updated = changeConsent(msg.sender, data_owner, data_requester, id, state);
ConsentUpdated(updated, msg.sender, data_owner, data_requester, state, id);
return updated;
}
| 13,109,547 |
./partial_match/1/0x3C333eC2A7072686164777e312e347eA30bc4A38/sources/RelayerOracleV1Volatility.sol | If x >= 2, then we compute the integer part of log2(x), which is larger than 0. If x > 1, then we compute the fraction part of log2(x), which is larger than 0. | function generalLog(uint256 x) public pure returns (uint) {
uint res = 0;
if (x >= FIXED_2) {
uint8 count = floorLog2(x / FIXED_1);
res = count * FIXED_1;
}
if (x > FIXED_1) {
for (uint8 i = 127; i > 0; --i) {
if (x >= FIXED_2) {
... | 4,451,464 |
./full_match/1/0x00000000009726632680FB29d3F7A9734E3010E2/sources/contracts/routers/BaseAggregator.sol | method that executes ERC20 to ERC20 token swaps with the ability to take a fee from the input and accepts a signature to use permit, so the user doesn't have to make an previous approval transaction sellTokenAddress the address of token that the user is selling buyTokenAddress the address of token that the user shoul... | function fillQuoteTokenToTokenWithPermit(
address sellTokenAddress,
address buyTokenAddress,
address payable target,
bytes calldata swapCallData,
uint256 sellAmount,
uint256 feeAmount,
PermitHelper.Permit calldata permitData
) external payable nonReentrant... | 4,840,370 |
pragma solidity 0.5.1;
pragma experimental ABIEncoderV2;
import "@0xcert/ethereum-proxy-contracts/src/contracts/iproxy.sol";
import "@0xcert/ethereum-proxy-contracts/src/contracts/xcert-create-proxy.sol";
/**
* @dev Decentralize exchange, creating, updating and other actions for fundgible and non-fundgible
* token... | Helper function that makes transfes. _order Data needed for order./ | function _doActions(
OrderData memory _order
)
private
{
for(uint256 i = 0; i < _order.actions.length; i++)
{
require(
idToProxy[_order.actions[i].proxy] != address(0),
INVALID_PROXY
);
if(_order.actions[i].kind == ActionKind.create)
{
require(
... | 12,725,707 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "./interfaces/IResource.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20MetadataUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/E... | Function to see pending tokens _pid Identifier of the pool in which we consult the pending rewards _user User that consult the rewards | function pendingResource(uint256 _pid, address _user) external view returns (uint256) {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 accResourcePerShare = pool.accResourcePerShare;
uint256 lpSupply = pool.lpToken.balanceOf(address(thi... | 12,674,145 |
/**
* Dev. `Akena Ver.3.0.5: lockTime`
*/
pragma solidity >=0.4.16 < 0.9.0;
interface tokenRecipient {
function receiveApproval(address _from, uint256 _value, address _token, bytes calldata _extraData) external;
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256)... | unlock of Account/ | function unlockAccount(address account) onlyOwner public{
lockedAccount[account] = 0;
emit LockAccount(account,0);
}
| 580,304 |
pragma solidity^0.4.24;
contract DSAuthority {
function canCall(
address src, address dst, bytes4 sig
) public view returns (bool);
}
contract DSAuthEvents {
event LogSetAuthority (address indexed authority);
event LogSetOwner (address indexed owner);
}
contract DSAuth is ... | Current/next campaign charity balance | function charityBalance() external view returns(uint) {
if(active()){
return campaigns[lastCampaignID].total.balanceETH.wmul(campaigns[lastCampaignID].charityFraction);
if(!campaigns[lastCampaignID].finalized) {
return campaigns[lastCampaignID].total.balanceETH.wmul(c... | 7,266,178 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.