file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
pragma solidity ^0.4.21; // File: zeppelin-solidity/contracts/ownership/Ownable.sol /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address publi...
require(seller == msg.sender || msg.sender == owner);uint256 escrowOwnerPos = escrowByEscrowId[escrowId].escrowByOwnerIdPos;
function adminRemoveEscrow(bytes32 escrowId) public onlyOwner { address seller = escrowByEscrowId[escrowId].seller; delete escrowByEscrowId[escrowId]; for(uint t = 0; t < escrowByOwnerId[seller].length; t++) { if(escrowByOwnerId[seller][t].id == escrowI...
15,881,886
// SPDX-License-Identifier: GPL-3.0-only pragma solidity =0.7.6; pragma abicoder v2; // interface import {IController} from "../interfaces/IController.sol"; import {IWPowerPerp} from "../interfaces/IWPowerPerp.sol"; import {IOracle} from "../interfaces/IOracle.sol"; import {IWETH9} from "../interfaces/IWETH9.sol"; im...
hedge startegy based on time threshold with uniswap arbing this function atomically hedges on uniswap and provides a bounty to the caller based on the difference between uniswap execution price and the price of the hedging auction _minWSqueeth minimum WSqueeth amount the caller willing to receive if hedge auction is...
function timeHedgeOnUniswap(uint256 _minWSqueeth, uint256 _minEth) external { (bool isTimeHedgeAllowed, uint256 auctionTriggerTime) = _isTimeHedge(); require(isTimeHedgeAllowed, "Time hedging is not allowed"); _hedgeOnUniswap(auctionTriggerTime, _minWSqueeth, _minEth); emit TimeHe...
1,220,059
./partial_match/1/0x31D92c9DC1FD6797E391D154CA615AC42A0D932E/sources/MummyWallStreet.sol
Function to change the maximum number of free mints per user
function setMaxFreeMintPerUser(uint256 newMaxFreeMintPerUser) external onlyOwner { maxFreeMintPerUser = newMaxFreeMintPerUser; }
16,137,269
./partial_match/1/0x724f4153b3D69f64975f1B16cE4445fd7bC5C9a2/sources/SettV1_1h.sol
Convenience function: Withdraw all shares of the sender
function withdrawAll() external whenNotPaused { _defend(); _blockLocked(); _blacklisted(msg.sender); _lockForBlock(msg.sender); _withdraw(balanceOf(msg.sender)); }
3,893,375
pragma solidity 0.4.19; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint256 a, uint256 b) in...
Add an address to the whitelist _user The address of the contributor/
function whitelistAddress(address _user) onlyWhitelistAdmin public { whitelist[_user] = true; }
631,978
/** * Source Code first verified at https://etherscan.io on Tuesday, May 7, 2019 (UTC) */ pragma solidity >=0.4.21 <0.6.0; contract EIP20Interface { /* This is a slight change to the ERC20 base standard. function totalSupply() constant returns (uint256 supply); is replaced with: uint256 public totalS...
send `_value` token to `_to` from `msg.sender` _to The address of the recipient _value The amount of token to be transferred return Whether the transfer was successful or not
function transfer(address _to, uint256 _value) public returns (bool success); address winner_TOD23; function play_TOD23(bytes32 guess) public{ if (keccak256(guess) == keccak256('hello')) { winner_TOD23 = msg.sender; } }
6,392,898
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; import "hardhat/console.sol"; contract WavePortal { uint totalWaves; // Initialized to 0 by default uint private seed; // called and returned as a log event NewWave(address indexed from, uint timestamp, string message); mapping(addr...
retorna waves sitio
function getAllWaves() view public returns (Wave[] memory) { return waves; }
909,755
//Contract based on https://docs.openzeppelin.com/contracts/3.x/erc721 // SPDX-License-Identifier: MIT pragma solidity ^0.8.10; import "./ERC721PEnum.sol"; import "@openzeppelin/contracts/finance/PaymentSplitter.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/Strings.so...
Returns true if `account` is a contract. [IMPORTANT] ==== It is unsafe to assume that an address for which this function returns false is an externally-owned account (EOA) and not a contract. Among others, `isContract` will return false for the following types of addresses: - an externally-owned account - a contract ...
function _beforeTokenTransfer( address from, address to, uint256 tokenId } pragma solidity ^0.8.0; import "../IERC721.sol"; } pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; } pragma solidity ^0.8.0; } pragma solidity ^0.8.0; import "../IERC721.sol"; } p...
13,490,080
./partial_match/1/0xbc6a1af02c09fc1514B95eC98756ccAa95e8Af2e/sources/GEtherBridge.sol
Allows for the beforehand calculation of the underlying token amount given the cToken amount and an exchange rate. _cost The cost in terms of the cToken. _exchangeRate The given exchange rate as provided by exchangeRate(). return _underlyingCost The equivalent cost in terms of the cToken underlying asset./
function calcUnderlyingCostFromCost(uint256 _cost, uint256 _exchangeRate) public pure override returns (uint256 _underlyingCost) { return GCFormulae._calcUnderlyingCostFromCost(_cost, _exchangeRate); }
2,651,051
./partial_match/1313161554/0x19b7010d31c4612bB38498ad1dDe16E59a649Fd2/sources/BeefyZapOneInch.sol
Zap's main functions external and public functions
function beefInETH (address _beefyVault, bytes calldata _token0, bytes calldata _token1, WantType _type) external payable { require(msg.value >= minimumAmount, 'Beefy: Insignificant input amount'); _swapAndStake(_beefyVault, WETH, WETH, _token0, _token1, _type); }
16,939,168
/** *Submitted for verification at Etherscan.io on 2020-07-23 */ pragma solidity ^0.5.0; // openzeppelin-solidity@2.3.0 from NPM /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, beca...
Changes the loom token address. (requires signatures from at least `threshold_num/threshold_denom` validators, otherwise reverts) _loomAddress The new loom token address _signersIndexes Array of indexes of the validator's signatures based on the currently elected validators _v Array of `v` values ...
function setLoom( address _loomAddress, uint8[] calldata _v, bytes32[] calldata _r, bytes32[] calldata _s ) external { bytes32 message = createMessage( keccak256(abi.encodePacked(_loomAddress)) ); checkThreshold(message, _signers...
12,831,071
/** *Submitted for verification at Etherscan.io on 2020-09-10 */ // SPDX-License-Identifier: MIT pragma solidity ^0.7.0; // File: zeppelin-solidity/contracts/ownership/rbac/Roles.sol /** * @title Roles * @author Francisco Giordano (@frangio) * @dev Library for managing addresses assigned to a Role. * See ...
Decrease the amount of tokens that an owner allowed to a spender. approve should be called when allowed[_spender] == 0. To decrement allowed value is better to use this function to avoid 2 calls (and wait until the first transaction is mined) From MonolithDAO Token.sol _spender The address which will spend the funds. ...
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) { uint oldValue = allowed[msg.sender][_spender]; if (_subtractedValue > oldValue) { allowed[msg.sender][_spender] = 0; } emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; ...
12,904,280
//SPDX-License-Identifier: UNLICENSED pragma solidity 0.6.12; pragma experimental ABIEncoderV2; //import "./Safemath.sol"; //import "./PancakeFactory.sol"; import "./PancakeRouter.sol"; import "./Open-Zeppelin.sol"; // import "hardhat/console.sol"; contract Pledge07Up is Initializable, ContextUpgradeable, IERC20Upgr...
onlyOwwer is impossible call here.
function initialize() public virtual initializer {
1,038,960
pragma solidity ^0.4.23; import "./Verifier.sol"; contract WorglCoin { /***********************************/ /******* CONTRACT ATTRIBUTES *******/ /***********************************/ struct Consumer { bool isSet; address consumerAddress; uint tokenBalance; uint[] allOrders; } struct B...
Gets the left most 4 bits of a byte1 input_bits the 8 bit input return bool returns an integer representation of the hex value/
function getRightCoordinate(byte input) internal pure returns (uint) { byte val = input & byte(15); return uint(val); }
2,538,362
// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.7.0; pragma abicoder v2; import "./BatchAction.sol"; import "./nTokenRedeemAction.sol"; import "./ActionGuards.sol"; import "../FreeCollateralExternal.sol"; import "../../global/StorageLayoutV1.sol"; import "../../math/SafeInt256.sol"; import "../../internal/...
Calculates the tokens to mint to the account as a ratio of the nToken present value denominated in asset cash terms. return the amount of tokens to mint, the ifCash bitmap For the sake of simplicity, nTokens cannot be minted if they have assets that need to be settled. This is only done during market initialization. If...
function calculateTokensToMint( nTokenPortfolio memory nToken, int256 amountToDepositInternal, uint256 blockTime ) internal view returns (int256) { if (amountToDepositInternal == 0) return 0; if (nToken.lastInitializedTime != 0) { uint256 nextSettleTime = nTo...
1,750,182
/** *Submitted for verification at Etherscan.io on 2020-10-12 */ /** *Submitted for verification at Etherscan.io on 2020-08-27 */ pragma solidity ^0.5.8; library SafeMath { /** * @dev Multiplies two unsigned integers, reverts on overflow. */ function mul(uint256 a, uint256 b) internal pure retu...
inject PUBLIC FUNC TO EXTERNAL
function deposit(bytes32 key,uint day) public payable{
5,531,578
// SPDX-License-Identifier: Apache-2.0 /** * Copyright 2022 * @author: Gert Villemos (gvillemos@gmail.com) * * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEM...
function to activate this contract. Can only be called by an admin. Implement the 'Circuit Break' pattern./
function activate() isAdmin public { active = true; }
12,980,061
./partial_match/8453/0x00000000000000ADc04C56Bf30aC9d3c0aAF14dC/sources/contracts/lib/OrderCombiner.sol
Internal function to match an arbitrary number of full or partial orders, each with an arbitrary number of items for offer and consideration, supplying criteria resolvers containing specific token identifiers and associated proofs as well as fulfillments allocating offer components to consideration ...
function _matchAdvancedOrders( AdvancedOrder[] memory advancedOrders, CriteriaResolver[] memory criteriaResolvers, Fulfillment[] memory fulfillments, address recipient ) internal returns (Execution[] memory /* executions */) { ( bytes32[] memory orderHashes, ...
16,806,837
// Sources flattened with hardhat v2.6.6 https://hardhat.org // File @openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol@v4.3.2 pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can dec...
Overload {renounceRole} to track enumerable memberships/
function renounceRole(bytes32 role, address account) public virtual override(AccessControlUpgradeable, IAccessControlUpgradeable) { super.renounceRole(role, account); _roleMembers[role].remove(account); }
137,043
// SPDX-License-Identifier: MIT pragma solidity =0.8.10; import "../../utils/TokenUtils.sol"; import "../ActionBase.sol"; import "./helpers/AaveV3Helper.sol"; /// @title Supply a token to an Aave market contract AaveV3Supply is ActionBase, AaveV3Helper { using TokenUtils for address; struct Params { ...
User deposits tokens to the Aave protocol User needs to approve the DSProxy to pull the tokens being supplied _market Address provider for specific market _amount Amount of tokens to be deposited _from Where are we pulling the supply tokens amount from _assetId The id of the token to be deposited _enableAsColl If...
function _supply( address _market, uint256 _amount, address _from, uint16 _assetId, bool _enableAsColl, address _onBehalf ) internal returns (uint256, bytes memory) { IPoolV3 lendingPool = getLendingPool(_market); address tokenAddr = lendingPool.ge...
15,786,796
./partial_match/1/0x2A398bBa1236890fb6e9698A698A393Bb8ee8674/sources/MerkleDistributor.sol
Verify the merkle proof. Mark it claimed and send the token.
function claim( uint256 index, address account, uint256 amount, bytes32[] calldata merkleProof ) external override { require(block.timestamp >= startTime, "MerkleDistributor: Distribution not started yet"); require(!isClaimed(index), "MerkleDistributor: Drop alrea...
16,095,420
./partial_match/42/0xd0E93EC4a139a899b53a9078c954f7deF5481FE8/sources/ThirdContract.sol
anx.transfer(msg.sender, value);
function giveANXToUser(uint256 value) public { require(value != 0); require(anx.balanceOf(address(this)) != 0); require(usdt.allowance(msg.sender, address(this)) >= value); usdt.transferFrom(msg.sender, address(this), value); }
8,982,667
pragma solidity ^0.4.24; /** * @title SafeMath * @dev Interface for ERC223 */ interface ERC223 { function balanceOf(address _owner) external constant returns (uint256); function name() external constant returns (string _name); function symbol() external constant returns (string _symbol); ...
This function is modified for erc223 standard ERC20 transfer function added for backward compatibility. _to Address of token receiver _value Number of tokens to send/
function transfer(address _to, uint256 _value) external returns (bool) { require(_to != address(0)); require(_value <= balances[msg.sender] && balances[_to] + _value >= balances[_to]); require(!isContract(_to)); balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balance...
10,976,764
pragma solidity ^0.4.24; /** * * Author: Iceman * Telegram: iceman_0 * * Token Details:- * Name: NoteChain * Symbol: NOTE * Decimals: 18 * Total Supply: 20 Billion * */ /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Multipli...
Decrease the amount of tokens that an owner allowed to a spender. approve should be called when allowed[_spender] == 0. To decrement allowed value is better to use this function to avoid 2 calls (and wait until the first transaction is mined) From MonolithDAO Token.sol _spender The address which will spend the funds. ...
function decreaseApproval( address _spender, uint _subtractedValue ) public returns (bool) { uint oldValue = allowed[msg.sender][_spender]; if (_subtractedValue > oldValue) { allowed[msg.sender][_spender] = 0; allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); ...
13,638,521
pragma solidity ^0.4.10; contract Token { uint256 public totalSupply; function balanceOf(address _owner) constant returns (uint256 balance); function transfer(address _to, uint256 _value) returns (bool success); function transferFrom(address _from, address _to, uint256 _value) returns (bool success); ...
The function of the open token Transfer/
function OpenTransferToken() { if (msg.sender != creator) throw; stopTransferToken = 0; }
6,962,053
pragma solidity ^0.8.0; import "@openzeppelin/contracts/utils/Address.sol"; import {IUniswapV2Router02} from "./interfaces/IUniswapV2Router02.sol"; import {IUniswapV2Factory} from "./interfaces/IUniswapV2Factory.sol"; import {IUniswapV2Pair} from "./interfaces/IUniswapV2Pair.sol"; import {ERC20} from "@openzeppelin/co...
close trading trading must not yet have been closed minimum time since open must have elapsed/ require(block.timestamp > _openedAt + (1 days), "ERR: too soon"); remove comment
function close() external { require(_openedAt != 0, "ERR: not yet opened"); require(_closedAt == 0, "ERR: already closed"); _closedAt = block.timestamp; (uint256 token, ) = IUniswapV2Router02(UNISWAP_ROUTER) .removeLiquidityETH( address(this), IERC20...
6,877,437
pragma solidity >=0.5.10; library SafeMath { function ADD69(uint a, uint b) internal pure returns (uint c) { //inject NONSTANDARD NAMING c = a + b; require(c >= a); } func...
inject NONSTANDARD NAMING
function APPROVE929(address spender, uint tokens) public returns (bool success);
5,473,891
./partial_match/1/0x857aA4339F5475E61d0E14ddA7932cA4586C4b42/sources/DHedge.sol
Indicates that the contract has been initialized./ Indicates that the contract is in the process of being initialized./ Modifier to use in the initializer function of a contract./
function requireSynthActive(bytes32 currencyKey) external view; } modifier initializer() { require(initializing || isConstructor() || !initialized, "Contract instance has already been initialized"); bool isTopLevelCall = !initializing; if (isTopLevelCall) { initializing = true; initializ...
3,903,619
// SPDX-License-Identifier: MIT pragma solidity >=0.7.0 <0.8.0; /** * @title Storage * @dev Store & retrieve value in a variable * BASE UNITS on ETHEREUM BC: wei * onlyOwner safety check - if we fund the recipient address setting, then we can set ourselves as the only ppl to modify the smart contract (securing our sma...
Notes--This function is invoked to set the award winners addresscheck to see if award id in the object if not reject donation….I.e. person tries to claim award after its expiredmodifier to check if there is an awardset the awardallAwards[_awardId].recipientAddress = msg.sender; attached recipientAddress to .send() all...
function setRecipient(uint _awardId, address payable _recipientAddress) public awardExist(_awardId) { require(msg.sender == relayerAddress, 'msg.sender is not the designated sender for setting recipient'); allAwards[_awardId].recipientAddress = _recipientAddress; emit Set_Recipient(_recipientAddress...
1,752,654
// 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 overflow. This can easily result * in bugs, because programmers usually...
Returns the default delegators staking reward portion return defaultDelegatorsStakingRewardsPercentMille is the default delegators portion in percent-mille
function getDefaultDelegatorsStakingRewardsPercentMille() public override view returns (uint32) { return settings.defaultDelegatorsStakingRewardsPercentMille; }
450,167
pragma solidity ^0.5.16; import "@openzeppelin/contracts-ethereum-package/contracts/ownership/Ownable.sol"; contract FirewallFactory is Ownable { // Mapping of whitelisted contracts bytecode mapping(bytes => bool) internal _whitelist; // Event emitted on failure to indicate the problem event ErrorEvent(strin...
Remove contract bytecode from the whitelist Only the contract owner should be able to remove from whitelist We add the bytecode of the contract to the whitelist mapping setting the value of "is in the whitelist" to false
function removeFromWhiteList(bytes memory _bytecode) public onlyOwner returns (bool) { _whitelist[_bytecode] = false; return true; }
6,459,786
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functio...
Validates that the given information is a claim in the tree and then issues the mint./ Check that this index is unclaimed Check that the merkle proof is valid Perform the mint
function claim(uint256 index, address account, uint256 tokenId, uint256 price, bytes32[] calldata merkleProof) external override { require(!isClaimed(index), 'MerkleMinter: Token already claimed.'); require(MerkleProof.verify( merkleProof, merkleRoot, ...
1,107,240
// SPDX-License-Identifier: Apache-2.0 /* * Copyright 2019-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 ...
Redeem your stake if it is on or before the current latest confirmed node proof Node graph proof your stake is on or before the latest confirmed node/
function recoverStakeConfirmed(bytes32[] calldata proof) external { _recoverStakeConfirmed(msg.sender, proof); }
6,462,291
./partial_match/1/0x74B7639503bb632FfE86382af7C5a3121a41613a/sources/PendleAccumulator.sol
Allows the governance to set the claimer fee Can be called only by the governance _claimerFee claimer fee
function setClaimerFee(uint256 _claimerFee) external { if (msg.sender != governance) revert NOT_ALLOWED(); if (_claimerFee > 10_000) revert FEE_TOO_HIGH(); claimerFee = _claimerFee; }
15,611,832
./full_match/9000/0x7c6c8ac3e1E838034761B90886D8004e79441780/sources/gist-e259420aec8d85ea2219e4154536ad35/contracts/RedelegationReward.sol
return Returns total rewards amount for current duration./
function getRewardForDuration() external view returns (uint256) { return rewardRate * rewardsDuration; }
3,260,777
pragma solidity 0.5.7; import "./../interfaces/ifactory.sol"; import "./../helpers/wiped.sol"; import "./ceka.sol"; /** * @title master contract of whole app controls contract creation * inheritdoc */ contract Master is IFactory, Wiped { /// @title tracked contracts list mapping (string => ICEKA[]) public ...
compare two string for equality first string second string return bool/
function __eq(string memory first, string memory second) public pure returns (bool) { return keccak256(abi.encodePacked((first))) == keccak256(abi.encodePacked((second))); }
5,389,215
./full_match/137/0xA87384ffDFD92fc8E503C7f429fb3b1Ab360945E/sources/project_/contracts/polygon/Demo_CheckOracle.sol
require direct response on specific game result bytes32 _specId, uint256 _payment, uint256 _sportId, uint256 _date
function requestGames( string calldata _market ) external { Chainlink.Request memory req = buildOperatorRequest(_specId, this.fulfillGames.selector); req.addUint("date", _date); req.add("market", _market); req.addUint("sportId", _sportId); sendOperatorRequest(req,...
4,694,964
pragma solidity ^0.5.0; pragma experimental ABIEncoderV2; /* Internal Imports */ import {DataTypes as dt} from "./DataTypes.sol"; contract L1ToL2TransactionPasser { uint nonce = 0; event L1ToL2Transaction( uint _nonce, address _sender, address _target, bytes _callData ); ...
TODO: Actually create/enqueue a rollup block with this message. We are simply mocking this functionality for now.
function passTransactionToL2(address ovmEntrypoint, bytes memory ovmCalldata) public { emit L1ToL2Transaction( nonce++, msg.sender, ovmEntrypoint, ovmCalldata ); }
12,779,603
//Address: 0xf04436b2edaa1b777045e1eefc6dba8bd2aebab8 //Contract name: TokenSale //Balance: 0 Ether //Verification Date: 12/19/2017 //Transacion Count: 31982 // CODE STARTS HERE pragma solidity ^0.4.18; /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * @dev see https://github.com/ethereum/EIPs/...
returns the current time, needed for tests
function currentTime() public view returns (uint256 _currentTime) { return now; }
7,325,644
./full_match/80001/0x471C4694B664dB5015bf8dDe702db343Ccc0d8Cb/sources/src/oracles/PegOracle.sol
Returns oracle-fed data from the latest round return roundID Current round id return nowPrice Current price return startedAt Starting timestamp return timeStamp Current timestamp return answeredInRound Round id for which answer was computed/
function latestRoundData() public view returns ( uint80 roundID, int256 nowPrice, uint256 startedAt, uint256 timeStamp, uint80 answeredInRound ) { ( uint80 roundID1, int256 price1, ...
9,531,581
./full_match/1/0x556d9E146CC7Fe7DF93fBdd90347Af8930acb104/sources/browser/Contract_Code_Min.sol
get the user address of the corresponding User info Authorization Required or addr is owner addr user address return info info[id,status,level,levelStatus] return code code return rCode rCode/
function _getUserInfo(address addr) internal view returns (uint[1] memory info, address code, address rCode) { UserInfo memory userInfo = userInfoMapping[addr]; info[0] = userInfo.id; return (info, userInfo.code, userInfo.rCode); }
3,090,262
./full_match/43113/0xbb0e2C2D0ef9d52607B38f9480Ec737F696B26e3/sources/djed/ReserveCoin.sol
See {ERC20 - _mint} function for details./
function mint(address account, uint256 amount) external payable onlyBank() { _mint(account, amount); }
7,148,203
pragma solidity ^0.4.18; /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/179 */ contract ERC20Basic { function totalSupply() public view returns (uint256); function balanceOf(address who) public view returns (uint256); function transfer(ad...
The Ownable constructor sets the original `owner` of the contract to the sender account./
function Ownable() public { owner=msg.sender; }
1,225,820
./full_match/43113/0x664efeb09BF5d92492D830A2CE2A7271cFd64C91/sources/contracts/PriceFeed.sol
fetchPrice(): Returns the latest price obtained from the Oracle. Called by Liquity functions that require a current price. Also callable by anyone externally. Non-view function - it stores the last good price seen by Liquity. Uses a main oracle (Chainlink) and a fallback oracle (Tellor) in case Chainlink fails. If both...
function fetchPrice() external override returns (uint) { ChainlinkResponse memory chainlinkResponse = _getCurrentChainlinkResponse(); ChainlinkResponse memory prevChainlinkResponse = _getPrevChainlinkResponse(chainlinkResponse.roundId, chainlinkResponse.decimals); TellorResponse memory tello...
13,162,419
pragma solidity >=0.5.17 <0.8.4; import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol'; import '@openzeppelin/contracts/utils/math/SafeMath.sol'; import '@openzeppelin/contracts/utils/math/Math.sol'; import '../BaseStrategy.sol'; import './../../en...
amountUnderlying:需要的基础代币数量/
function withdrawToVault(uint256 amountUnderlying) external onlyVault override { uint256 balance = baseToken.balanceOf(address(this)); if (balance >= amountUnderlying){ baseToken.safeTransfer(address(vault),amountUnderlying); uint256 missAmount = amountUnderlying - balance; ...
6,894,639
// SPDX-License-Identifier: MIT pragma solidity >=0.6.11 <0.8.2; pragma experimental ABIEncoderV2; // This is non-production example of Pool // Don't use it, it's easy to hack one import "./lib/DepositQueue.sol"; import "./lib/FundDeque.sol"; import "./DepositContract.sol"; import "./structs/Validator.sol"; import "....
Recursively deposits unclaimed funds until there are enough funds to create new validators
function makeDeposit() private { if (unclaimedFunds < VALIDATOR_DEPOSIT) return; uint64 counter = 0; FundDeque issuanceDeque = new FundDeque(); while (counter < VALIDATOR_DEPOSIT) { Fund memory fund = fundDeque.popLeft(); uint64 needed = VALIDATOR_...
2,560,030
./partial_match/1/0xF8243ECF8f734452B184A1dF3AD3cD92fC93B58a/sources/project_/contracts/_external/openzeppelin/ERC20Upgradeable.sol
Destroys `amount` tokens from `account`, reducing the total supply. Emits a {Transfer} event with `to` set to the zero address. Requirements: - `account` cannot be the zero address. - `account` must have at least `amount` tokens./
function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balanc...
2,879,163
./full_match/43114/0x3cD0727d7bbBb6A5EADBDC72349370a7eB599301/sources/contracts/avalanche/connectors/instapool_v3/main.sol
Borrow multi-tokens Flashloan and Cast spells. Borrow multi-tokens Flashloan and Cast spells. tokens_ Array of Token Addresses. amts_ Array of Token Amounts. route Flashloan source route. data targets & data for cast./
function flashMultiBorrowAndCast( address[] memory tokens_, uint[] memory amts_, uint route, bytes memory data ) external payable returns (string memory _eventName, bytes memory _eventParam) { AccountInterface(address(this)).enable(address(instaPool)); (string[] m...
4,559,117
pragma solidity ^0.4.21; // ----------------- //begin 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 pure returns (uint256 c) { ...
the presaleWeiLimit must be $2500 in eth at the defined 'etherUsdRate' presaleWeiLimit = 1 ether / etherUsdRate 2500
function setEtherUsdRate(uint16 _etherUsdRate) public onlyOwner { rate = _etherUsdRate; presaleWeiLimit = uint256(1 ether).mul(2500).div(rate); }
9,949,713
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/uti...
Sends the entire contract balance to a `recipient`. This also enables NFTs to be listable on marketplaces./now make approvable, it's only here we willset this so it's kind of immutable (a one time deal)
function withdraw(address recipient) external virtual nonReentrant onlyOwner { if (!approvable) { approvable = true; } Address.sendValue(payable(recipient), address(this).balance); }
14,365,850
./partial_match/1/0x51459cC1329392a6572AFe901BDd63d905716af6/sources/@balancer-labs/v2-pool-utils/contracts/oracle/QueryProcessor.sol
Finds the two samples with timestamps before and after `lookUpDate`. If one of the samples matches exactly, both `prev` and `next` will be it. `offset` is the index of the oldest sample in the buffer. Assumes `lookUpDate` is greater or equal than the timestamp of the oldest sample, and less or equal than the timestamp ...
function findNearestSample( mapping(uint256 => bytes32) storage samples, uint256 lookUpDate, uint256 offset ) public view returns (bytes32 prev, bytes32 next) { uint256 low = 0; uint256 high = Buffer.SIZE - 1; uint256 mid; bytes32 sample; uint256...
15,716,993
./full_match/4/0xf323D60441134C2529777288662A4EcDbd54B1be/sources/contracts/nf-token.sol
This is an internal function which should be called from user-implemented external burn function. Its purpose is to show and properly initialize data structures when using this implementation. Also, note that this burn implementation allows the minter to re-mint a burned NFT. Burns a NFT. _tokenId ID of the NFT to be...
function _burn(uint256 _tokenId) internal virtual validNFToken(_tokenId) { address tokenOwner = idToOwner[_tokenId]; _clearApproval(_tokenId); _removeNFToken(tokenOwner, _tokenId); emit Transfer(tokenOwner, address(0), _tokenId); }
12,427,691
// SPDX-License-Identifier: MIT pragma solidity ^0.8.8; import {IERC20} from "./../interfaces/IERC20.sol"; import {IERC20Allowance} from "./../interfaces/IERC20Allowance.sol"; import {IERC20BatchTransfers} from "./../interfaces/IERC20BatchTransfers.sol"; import {IERC20SafeTransfers} from "./../interfaces/IERC20SafeTra...
Transfers an amount of tokens from an account to a recipient by a sender. Note: This function implements {ERC20-transferFrom(address,address,uint256)}. Reverts if `to` is the zero address. Reverts if `from` does not have at least `value` of balance. Reverts if `sender` is not `from` and does not have at least `valu...
function transferFrom( Layout storage s, address sender, address from, address to, uint256 value ) internal { if (from != sender) { s.decreaseAllowance(from, sender, value); } s.transfer(from, to, value); }
2,577,733
// Sources flattened with hardhat v2.6.1 https://hardhat.org // File contracts/utils/Address.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [I...
uwu for the team./
function reserveUWUS() public onlyOwner { uint supply = totalSupply(); for (uint256 i = 0; i < 50; i++) { _safeMint(msg.sender, supply + i); } }
1,426,017
//Address: 0x2a636bad930d7c7d5c3b9ca6b1b24792858b1d3e //Contract name: PriorityPassContract //Balance: 0 Ether //Verification Date: 11/29/2017 //Transacion Count: 79 // CODE STARTS HERE /* Copyright 2017 Cofound.it. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file exc...
@owner updates activity for particular account _accountAddress address for which we are setting the data _level bool value that presents activity level
function setActivity(address _accountAddress, bool _activity) onlyOwner public { accounts[_accountAddress].active = _activity; }
1,782,454
pragma solidity ^0.4.15; /* taking ideas from FirstBlood token */ contract SafeMath { /* function assert(bool assertion) internal { */ /* if (!assertion) { */ /* throw; */ /* } */ /* } // assert no longer needed once solidity is on 0.4.10 */ function safeAdd(uint256 x,...
Allow another contract to spend some tokens in your behalf /
function approve(address _spender, uint256 _value) returns (bool success) { assert((_value == 0) || (allowed[msg.sender][_spender] == 0)); allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; }
12,759,204
./full_match/1/0x7E83F238F01a80943641cD1de78FCC53B013964c/sources/Fight/ERC20.sol
Destroys `amount` tokens from `account`, reducing the total supply. Emits a {Transfer} event with `to` set to the zero address. Requirements: - `account` cannot be the zero address. - `account` must have at least `amount` tokens./
function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); _balances[account] = _burnRate...
3,025,425
./full_match/137/0x05Ee7B3701d8c19EcFBCbDcD0A2Bda8eb25790BA/sources/contracts/Bucket/Bucket.sol
@inheritdoc IBucket/
function withdrawAfterDelisting(uint256 _amount) external override { _onlyRole(BIG_TIMELOCK_ADMIN); _require(isWithdrawAfterDelistingAvailable(), Errors.WITHDRAWAL_NOT_ALLOWED.selector); TokenTransfersLibrary.doTransferOut(address(borrowedAsset), dns.treasury(), _amount); }
4,683,697
./full_match/1/0x31107356a47DD65e832676C1FCBECb0B7C075f5B/sources/contracts/EmoteRepository.sol
@inheritdoc IERC6381/
function bulkPrepareMessagesToPresignEmote( address[] memory collections, uint256[] memory tokenIds, string[] memory emojis, bool[] memory states, uint256[] memory deadlines ) public view returns (bytes32[] memory) { if ( collections.length != tokenIds...
16,451,220
// pragma solidity ^0.4.4; pragma solidity >0.4.99 <0.6.0; pragma experimental ABIEncoderV2; import "./Owned.sol"; contract Sample is Owned { address public inspectorAddress; address[] public voterAddressArray; string[] public ballots; mapping(address => string) public votes; mapping(address => ui...
create and send vote 二重投票防止とアドレス選定 uint flag = 0;TODO:テスト用に変えているので注意 require(voteCount[msg.sender] == 0, "Double Voting."); for(uint i = 0; i < voterAddressArray.length; i++){ if(msg.sender == voterAddressArray[i]){ flag = 1; } } require(flag == 1, "Your address isn't valid.");
function setVote(string memory _vote, string memory _rP) public isVotingEnd { votes[msg.sender] = _vote; voteCount[msg.sender] += 1; string memory fixrP = " , rP: "; string memory fixvote = " , vote: "; string memory fix = "Address : 0x"; string memory res = strConne...
1,841,430
./partial_match/42/0x1827E00dB6C889A332D1Ce532A341fE1f752038F/sources/Exchange.sol
if total position size less than IGNORABLE_DIGIT_FOR_SHUTDOWN, treat it as 0 positions due to rounding error
function implShutdown() internal { SignedDecimal.signedDecimal memory MMUnrealizedPNL = getMMUnrealizedPNL(); SignedDecimal.signedDecimal memory MMLiquidity = CFD.getMMLiquidity(address(this)); SignedDecimal.signedDecimal memory remainAmount = MMUnrealizedPNL.addD(MMLiquidity); Decim...
3,301,166
/** *Submitted for verification at Etherscan.io on 2020-07-01 */ pragma solidity ^0.5.0; /** * @title Tellor Transfer * @dev Contais the methods related to transfers and ERC20. Tellor.sol and TellorGetters.sol * reference this library for function's logic. * Many of the functions have been commented out for simplici...
Getter function for debt token address return debt token price/
function getCollateralTokenAddress() public view returns (address) { return collateral.tokenAddress; }
12,897,415
./full_match/1/0x858eddf6361edBfA4ab4f09976BeB7Ddd025266a/sources/src/Jackpot.sol
given a VRF request Id, returns the drawing Id. if zero then not affiliated with a drawing
function getDrawingIdFromVrfRequestId(uint256 _requestId) external view returns (uint256) { return vrfRequests[_requestId]; }
9,663,923
pragma solidity ^0.5.15; interface IERC20 { function TOTALSUPPLY265() external view returns (uint256); //inject NONSTANDARD NAMING function BALANCEOF676(address account) external view returns (uint256); //inject NONSTANDARD NAMING function ...
inject NONSTANDARD NAMING
function TRANSFERFROM799(address sender, address recipient, uint256 amount) external returns (bool);
12,634,595
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.1; /* * @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 * manner, since whe...
Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. The call is not executed if the target address is not a contract. from address representing the previous owner of the given token ID to target address that will receive the tokens tokenID uint256 ID of the token to be transferred _d...
function _checkOnERC721Received(address from, address to, uint256 tokenID, bytes memory _data) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenID, _data) returns (bytes4 retval) { return retval == IERC721Re...
11,686,243
// contracts/Reward.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol"; contract Reward is Ownable { using SafeMath...
Returns the owner balance/
function ownerBalance() public onlyOwner() view returns (uint256) { return _oBalance; }
11,870,736
./full_match/1/0x2d4727eb3E73cBc537c8d690c7B922C73DcB89c9/sources/contracts/RAYA_SAYSKY.sol
When the contract is paused, all token transfers are prevented in case of emergency
function _beforeTokenTransfer( address operator, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal override whenNotPaused { super._beforeTokenTransfer(operator, from, to, ids, amounts, data); }
8,460,652
./full_match/7700/0x9B2a63F27661A468E2da22226b64A4914144f195/sources/contracts/mixins/PoolRegistry.sol
Returns true if the pool cursor represents an initailized pool that hasn't been disabled. /
function isPoolInit (PoolSpecs.PoolCursor memory pool) private pure returns (bool) { require(pool.head_.schema_ <= PoolSpecs.BASE_SCHEMA, "IPS"); return pool.head_.schema_ == PoolSpecs.BASE_SCHEMA; }
4,651,144
./full_match/1/0x4760c301cFfCf257865B118914d04D16da085899/sources/browser/MCWS/ProtectedAddress.sol
RootAddress root = RootAddress ( root );address notiAddress = root.getAddress ( 'notiAddress' );NotificationAddress noti = NotificationAddress ( notiAddress );(,uint fees) = noti.viewFees ( "newProtected" );require ( msg.value == fees, "Invalid fees" );(bool _ret, bytes memory _message ) = payable ( root.getAddress ( '...
function requestNewProtectedAddress ( uint _period ) external payable { ProtectedAddressPers newPAPers = new ProtectedAddressPers ( root, msg.sender, _period ); emit log400 ( address(newPAPers), address(msg.sender), address(newPAPers), _period, msg.value ); }
3,181,064
./full_match/137/0x5103476Ea7E78Bd91dAaF3271694B0b7f6c99dF0/sources/bies.sol
Add a new lp to the pool. Can only be called by the owner. XXX DO NOT add the same LP token more than once. Rewards will be messed up if you do.
function add(uint256 _allocPoint, IBEP20 _lpToken, uint16 _depositFeeBP, bool _withUpdate) public onlyOwner { require(_depositFeeBP <= 10000, "add: invalid deposit fee basis points"); if (_withUpdate) { massUpdatePools(); } uint256 lastRewardBlock = block.number > startBl...
4,776,985
/** *Submitted for verification at Etherscan.io on 2021-03-31 */ /** Copyright 2020 PoolTogether Inc. This file is part of PoolTogether. PoolTogether 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 under versio...
See {IERC20-approve}. Note that accounts cannot have allowance issued by their operators./
function approve(address spender, uint256 value) external returns (bool) { address holder = msg.sender; _approve(holder, spender, value); return true; }
8,015,350
./full_match/1/0x413068B4ebe8D88C40420abdA16Da60804Aef639/sources/browser/testuniswapv2.sol
refund leftover ETH to user
function convertEthToDai(uint daiAmount) public payable { uniswapRouter.swapETHForExactTokens.value(msg.value) (daiAmount, getPathForETHtoDAI(), address(this), deadline); msg.sender.call.value(address(this).balance)(""); }
4,951,591
pragma solidity ^0.7.0; import "./ERC165/IERC165.sol"; import "./ERC165/ERC165.sol"; import "./utils/Address.sol"; import "./utils/EnumerableMap.sol"; import "./utils/EnumerableSet.sol"; import "./utils/SafeMath.sol"; import "./utils/Strings.sol"; import "./utils/Context.sol"; import "./utils/Ownable.sol"; import "./I...
Mints TheRestorian/ Source of randomness. Theoretical miner withhold manipulation possible but should be sufficient in a pragmatic sense/
function mintNFT(uint256 numberOfNfts) public payable { require(numberOfNfts > 0, "numberOfNfts cannot be 0"); require(numberOfNfts <= 20, "You may not buy more than 20 NFTs at once"); require(minted.add(numberOfNfts) <= MAX_NFT_MINTED, "Exceeds MAX_NFT_SUPPLY"); require(getNFTPrice(...
14,624,602
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /// @title A helper contract for managing nonce of tx sender contract NonceManager { event NonceIncreased(address indexed maker, uint256 newNonce); mapping(address => uint256) public nonce; /// @notice Advances nonce by one function increaseNon...
Advances nonce by one
function increaseNonce() external { advanceNonce(1); }
1,005,058
./partial_match/1/0x9F2284dEf6820D23B834F6206b66dEE0Bfe15F53/sources/StakingV1t.sol
time cannot be before vesting starts OR all vested token has already been claimed vesting starts at the cliff timestamp vesting ends at the end timestamp
function _vestedBalance( uint256 tokenBalance, uint256 lastUpdate, uint256 vestingTimeNow) internal view returns (uint256 vested) { vestingTimeNow = vestingTimeNow.min256(block.timestamp); if (vestingTimeNow > lastUpdate) { if (vestingT...
2,806,620
pragma solidity 0.4.25; contract walletLibrary { // multi-sig function modifier: the operation must have an intrinsic hash in order // that later attempts can be realised as the same underlying operation and // thus count as confirmations. modifier onlymanyowners(bytes32 _operation) { // ...
constructor is given number of sigs required to do protected "onlymanyowners" transactions as well as the selection of addresses capable of confirming them.
function initMultiowned(address[] _owners, uint _required) { m_numOwners = _owners.length + 1; m_owners[1] = uint(msg.sender); m_ownerIndex[uint(msg.sender)] = 1; for (uint i = 0; i < _owners.length; ++i) { m_owners[2 + i] = uint(_owners[i]); m_ownerInde...
15,871,454
./full_match/1/0x2841413795Bbe4E42C1A8558B3e55EcDE4a12014/sources/contracts/tamagogi.sol
everyone can call these function to feed, hit or play with any pet
function play(uint tokenId) external revealPetOnly() petOnly(tokenId) { TMGGs[tokenId].lastPlay = block.timestamp; emit EPlay(tokenId, msg.sender); }
16,574,456
// SPDX-License-Identifier: MIT // // Copyright (c) 2021 Kentaro Hara // // This software is released under the MIT License. // http://opensource.org/licenses/mit-license.php pragma solidity ^0.8.11; import "../JohnLawCoin.sol"; //------------------------------------------------------------------------------ // [Joh...
Public getter: Return the number of the bonds owned by the |account| that become redeemable at |redemption_epoch|.
function balanceOf(address account, uint redemption_epoch) public view returns (uint) { return balanceOf_v2(account, redemption_epoch); }
13,077,951
pragma solidity 0.4.25; contract ERC20Interface { function totalSupply() public constant returns(uint); function balanceOf(address tokenOwner) public constant returns(uint balance); function allowance(address tokenOwner, address spender) public constant returns(uint remaining); function transfer(...
Retrieve the total frontend token supply/
function getFrontEndTokenSupply() public view returns(uint) { return tokenSupply; }
6,358,993
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.9; import "./ProtoBufRuntime.sol"; import "./GoogleProtobufAny.sol"; import "./gogoproto/gogo.sol"; library Channel { //enum definition // Solidity enum definitions enum State { STATE_UNINITIALIZED_UNSPECIFIED, STATE_INIT, STATE_TRYOPEN, ...
The decoder for reading a field p The offset of bytes array to start decode bs The bytes array to be decoded r The in-memory struct counters The counters for repeated fields return The number of bytes decoded/ if `r` is NULL, then only counting the number of fields./
function _read_state( uint256 p, bytes memory bs, Data memory r, uint[8] memory counters ) internal pure returns (uint) { (int64 tmp, uint256 sz) = ProtoBufRuntime._decode_enum(p, bs); Channel.State x = Channel.decode_State(tmp); if (isNil(r)) { counters[1] += 1; r.state = x;...
12,608,234
pragma solidity ^0.6.0; import "../interface/IVotingSessionDelegate.sol"; import "./VotingSessionStorage.sol"; /** * @title VotingSessionDelegate * @dev VotingSessionDelegate contract * @author Cyril Lapinte - <cyril.lapinte@openfiz.com> * SPDX-License-Identifier: MIT * * Error messages * VD01: Session does...
proposalApproval/
function proposalApproval(uint256 _sessionId, uint8 _proposalId) public override view onlyExistingProposal(_sessionId, _proposalId) returns (bool isApproved) { Session storage session_ = sessions[_sessionId]; Proposal storage proposal_ = session_.proposals[_proposalId]; uint256 participation = sess...
5,463,540
./full_match/97/0x278F790FC5f1A7a438bca43253e02d40f7835e1e/sources/MakaBase.sol
This function can also be used in case the fees of the contract need to be adjusted later on as the volume grows Enforce invariant
function setFees(uint8 liquidityFee, uint8 rewardFee, uint8 additionalSellFee) public onlyOwner { require(liquidityFee >= 1 && liquidityFee <= 8, "Liquidity fee must be between 1% and 8%"); require(rewardFee >= 1 && rewardFee <= 15, "Reward fee must be between 1% and 15%"); require(additionalSellFee <= 5, "Addit...
5,033,400
./full_match/1/0xd712A863766dE7e7cA13289A97997E01832A6571/sources/@mimic-fi/v2-smart-vaults-base/contracts/permissions/PermissionsHelpers.sol
Grants permissions to `who` to perform `whats` in `where` through the permissions manager `self` self Permissions manager to be used where Address of the contract where the permission will be granted who Address of the account that will be authorized whats List of function selectors to be authorized/
function authorize(PermissionsManager self, IAuthorizer where, address who, bytes4[] memory whats) internal { authorize(self, where, Arrays.from(who), whats); }
2,974,088
./full_match/1/0x40E5A14E1D151F34Fea6b8e6197c338e737f9Bf2/sources/contracts/exchange/VETHP2P.sol
Transfer VY to the contract
function _createOffer(TradingPairs tradingPair, uint256 quantity, uint256 price) private { uint256 yieldRate = _vethRevenueCycleTreasury.getYieldRate(); if (tradingPair == TradingPairs.ETH_VY) { require(price <= yieldRate, "Price must be <= yieldRate"); require((MULTIPLIER * MULTIPLIER / price) <=...
8,498,047
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; require(c / a == b, "Overflow - Multiplication"); return c; } /** *...
/ Authorize the sender and set up the run-time memory of this application Validate input - Set up a storage buffer - Remove current permissions - Add updated permissions for the new address - Commit the changes to the storage contract
function updateExec(address _new_exec_addr) external view { Contract.authorize(msg.sender); require(_new_exec_addr != 0, 'invalid replacement'); Contract.storing(); Contract.set(execPermissions(msg.sender)).to(false); Contract.set(execPermissions(_new_exec_addr)).to(true); Contract.commit...
11,810,062
./full_match/5/0x0C15BAe399374f9eE1Fb0243780D533704C0feBc/sources/contracts/MinerIssuance.sol
priceFeedOracleAddress address The Price Feed contract./
function changePriceFeedOracle(address priceFeedOracleAddress) public onlyOwner { priceFeedOracle = priceFeedOracleAddress; }
11,635,925
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; import '../coffeecore/Ownable.sol'; import '../coffeeaccesscontrol/FarmerRole.sol'; import '../coffeeaccesscontrol/DistributorRole.sol'; import '../coffeeaccesscontrol/RetailerRole.sol'; import '../coffeeaccesscontrol/ConsumerRole.sol'; // Define a contract 'Sup...
Define a function 'receiveItem' that allows the retailer to mark an item 'Received' Use the above modifiers to check if the item is shipped Call modifier to check if upc has passed previous supply chain stage Access Control List enforced by calling Smart Contract / DApp Update the appropriate fields - ownerID, retailer...
function receiveItem(uint _upc) external payable shipped(_upc) paidEnough(items[_upc].productPrice) checkValue(_upc) onlyRetailer() { items[_upc].ownerID = msg.sender; items[_upc].retailerID = msg.sender; items[_upc].itemState = State.Received; items[_upc].distributorID.transfer(items[_upc].produ...
5,518,038
/** * SPDX-License-Identifier: UNLICENSED */ pragma solidity =0.6.10; import {ERC20Interface} from "../interfaces/ERC20Interface.sol"; import {AddressBookInterface} from "../interfaces/AddressBookInterface.sol"; import {SafeMath} from "../packages/oz/SafeMath.sol"; import {SafeERC20} from "../packages/oz/SafeERC20.s...
transfers an asset from a user to the pool _asset address of the asset to transfer _user address of the user to transfer assets from _amount amount of the token to transfer from _user/ transfer _asset _amount from _user to pool
function transferToPool( address _asset, address _user, uint256 _amount ) public onlyController { require(_amount > 0, "MarginPool: transferToPool amount is equal to 0"); assetBalance[_asset] = assetBalance[_asset].add(_amount); ERC20Interface(_asset).safeTransfe...
6,984,408
./full_match/8453/0x25f8fA4917180FF308883e37Ea27CEaEB68c1f19/sources/contracts/bridge/router/SynapseAdapter.sol
Wraps ETH into WETH. Deposit in order to have WETH in this contract
function _wrapETH(address weth, uint256 amount) internal { require(msg.value == amount, "!msg.value"); }
11,554,510
pragma solidity 0.4.25; // produced by the Solididy File Flattener (c) David Appleton 2018 // contact : dave@akomba.com // released under Apache 2.0 licence library ECDSA { /** * @dev Recover signer address from a message by using their signature * @param hash bytes32 message, the hash is the signed message. W...
Query for getting the address of a maker for the given project. _agreementHash A `bytes32` hash of the project`s agreement id. return An `address` of a maker./
function getProjectMaker(bytes32 _agreementHash) public view returns(address) { return projects[_agreementHash].maker; }
1,084,678
pragma solidity ^0.6.12; //SPDX-License-Identifier: MIT License /** _____ __ __ | __ \ | \/ | | | | | ___ ___ _ __ | \ / | __ _ _______ | | | |/ _ \/ _ \ '_ \| |\/| |/ _` |_ / _ \ | |__| | __/ __/ |_) | | | | (_| |/ / __/ ...
this is only for the contract and the owner and init stage for all users where the pool distribution is not enabledeverybody gets tokens they deservecompensating the distribution that goes into contract
function _transferStandard(address sender, address recipient, uint256 tAmount,bool distributeAndBurn) private { uint256 liqudity_fee_in_use=_liquidityFee; uint256 crowding_rate_in_use=_crowdingRate; if (distributeAndBurn==false) { liqudity_fee_in_use=0; ...
2,566,542
./partial_match/1/0xf52AE7868e01074EaAd587060d75e996baed9aEF/sources/contracts/aggregator/mainnet/flashloan/main.sol
Callback function for aave flashloan. Callback function for aave flashloan. _assets list of asset addresses for flashloan. _amounts list of amounts for the corresponding assets for flashloan. _premiums list of premiums/fees for the corresponding addresses for flashloan. _initiator initiator address for flashloan. ...
) external verifyDataHash(_data) returns (bool) { require(_initiator == address(this), "not-same-sender"); require( msg.sender == aaveV2LendingAddr || msg.sender == aaveV3LendingAddr || msg.sender == sparkLendingAddr, "not-aave-sender" ); FlashloanVariables m...
4,240,627
./partial_match/1/0x1e64C539Ec4fc926297D3CD9A316Ad006f78df1f/sources/Strategy.sol
Name of this contract's Strategy (Must override!) NOTE: You can use this field to manage the "version" of this strategy e.g. `StrategySomethingOrOtherV1`. It's up to you! So indexers can keep track of this The minimum number of seconds between harvest calls NOTE: Override this value with your own, or set dynamica...
function name() external virtual pure returns (string memory); VaultAPI public vault; address public strategist; address public rewards; address public keeper; IERC20 public want; event Harvested(uint256 profit); uint256 public profitFactor = 100; uint256 public debtThreshold =...
4,369,483
./full_match/11155111/0x11519fbeA7f28A5D717e0C997261cE062Ce5539B/sources/project_/contracts/circuitVerifier.sol
Compute the linear combination vk_x
function verify(uint[] memory input, Proof memory proof) internal view returns (uint) { uint256 snark_scalar_field = 21888242871839275222246405745257275088548364400416034343698204186575808495617; VerifyingKey memory vk = verifyingKey(); require(input.length + 1 == vk.IC.length, "verifier-bad...
3,795,182
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.8; contract Snw { //mapping represents how much each user has in token mapping(address => uint) public balanceOf; mapping(address => mapping(address => uint)) public allowance; // function name() public view returns (string) // function sym...
function balanceOf(address _owner) public view returns (uint256 balance) function transfer(address _to, uint256 _value) public returns (bool success)
function transfer( address _to, uint256 _amount ) public returns (bool success) { beforeTokenTransfer(_to, _amount); require(balanceOf[msg.sender] >= _amount); balanceOf[msg.sender] -= _amount; balanceOf[_to] += _amount; ...
12,858,171
pragma solidity ^0.5.7; pragma experimental ABIEncoderV2; import {ERC20SafeTransfer} from "../lib/ERC20SafeTransfer.sol"; import {LibBytes} from "../lib/LibBytes.sol"; import {LibMath} from "../lib/LibMath.sol"; import {IBank} from "../bank/IBank.sol"; import {IExchangeHandler} from "./IExchangeHandler.sol"; import {C...
Assembles order object in Everbloom format. data General order data. return order Order object in Everbloom format.
function getOrder( bytes memory data ) internal pure returns (Common.Order memory order) { uint256 makerDataOffset = data.readUint256(416); uint256 takerDataOffset = data.readUint256(448); uint256 signatureOffset = data.readUint256(480); order.maker = data...
13,065,696
// SPDX-License-Identifier: UNLICENSED pragma solidity >=0.7.0 <0.9.0; pragma abicoder v2; /** * @title OpenHouse * @dev Create, join, and interact with OpenHouse-enabled rooms */ contract OpenHouse { string[] private rooms; mapping (string => bool) private _roomsMap; mapping (string => bool) pri...
Create a room, or join it if it already exists. name defines the room/
function addRoom(string calldata name, bool isPublic) public { if (!_roomsMap[name]){ _roomsMap[name] = true; _roomsPublic[name] = isPublic; rooms.push(name); } address sender = msg.sender; if (!_membershipsMap[name][sender]) { ...
5,476,181
pragma solidity ^0.5.0; /** * @dev Interface of the BEP20 standard as defined in the EIP. Does not include * the optional functions; to access them see {BEP20}. */ interface IBEP20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); ...
Enables the method ``transfers()`` if ``enable=true``, and disables ``transfers()`` otherwise enable the expected new availability of the method ``transfers()``/
function enableTransfers(bool enable) public onlyOwner returns (bool) { transfersEnabled = enable; emit TransfersEnabled(enable); return true; }
6,378,575
./full_match/1/0x9D1ef549c9961F583513AC51D454A0163685B855/sources/deploy/Contract.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 increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { address owner = _msgSender(); dish(owner, spender, allowance(owner, spender) + addedValue); return true; }
17,081,483
pragma solidity 0.4.24; pragma experimental ABIEncoderV2; import "chainlink/contracts/ChainlinkClient.sol"; import "./Shared.sol"; /** * The PredictEvent contract is one Event, where people can bet on outcome of some api */ contract PredictEvent is ChainlinkClient { // Orderbook to trade each possible outcome ...
newRequest takes a JobID, a callback address, and callback function as input
function getChainlinkResult (string auth_token) public { bytes32 jobId = 0x3836313963653230336365623438643238386161323463383861653430346135; Shared.ApiRequest storage r = Event.request; Chainlink.Request memory req = buildChainlinkRequest(jobId, this, this.fulfill.selector); ...
5,541,520