file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
//SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface WETH9 { function balanceOf(address a) external view returns (uint); } library TransferHelper { function safeApprove( address token, address to, uint256 value ) internal { // bytes4(keccak256(bytes('approve(ad...
Collects up to a maximum amount of fees owed to a specific position to the recipient params tokenId The ID of the NFT for which tokens are being collected, recipient The account that should receive the tokens, amount0Max The maximum amount of token0 to collect, amount1Max The maximum amount of token1 to collect return...
{ function increaseLiquidityCurrentRange( uint256 tokenId, uint256 amountAdd0, address address1, uint256 amountAdd1, address address2 ) external payable returns ( uint128 liquidity, uint256 amount0, uint256 amoun...
14,803,236
./full_match/5/0xcc65Ea1d651ee8ACA6B8a0ba140221032aB73380/sources/lotto.sol
Calculates the winning ticket number based on the ending block hash, current ticket ID, block timestamp, block base fee, and remaining gas. return winningTicket The winning ticket number. The winning ticket number is calculated by hashing the packed encoding of the following: - The block hash of the block with the spec...
function _calculateWinningTicket() internal view virtual returns (uint256 winningTicket) { bytes32 bHash = blockhash(_endingBlock); require(bHash != 0, "wait a few confirmations"); winningTicket = uint256( keccak256( ...
7,084,984
./full_match/42/0x0303582606A1E6bc3b5de7A71016F3C739ec83e9/sources/cache/solpp-generated-contracts/lib/ABDKMath64x64.sol
Calculate x y rounding down. Revert on overflow. x signed 64.64-bit fixed point number y signed 64.64-bit fixed point number return signed 64.64-bit fixed point number/
function mul(int128 x, int128 y) internal pure returns (int128) { int256 result = (int256(x) * y) >> 64; require(result >= MIN_64x64 && result <= MAX_64x64, "115"); return int128(result); }
16,218,269
pragma solidity 0.6.12; /** * @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 returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. ...
Allow governance to rescue unclaimed inactive rewards
function rescue(address _rewardToken) public onlyGov { require(_rewardToken != address(stakingToken), "Cannot withdraw staking token"); RewardPool storage pool = rewardPools[_rewardToken]; require(pool.isActive == false, "Cannot withdraw active reward token"); uint _balance = IERC20...
6,982,265
// SPDX-License-Identifier: MIT pragma solidity ^0.6.0; import "./../interfaces/compound/Comptroller.sol"; import "./../interfaces/compound/CErc20.sol"; import "./../interfaces/erc20/Erc20.sol"; import "./IRouter.sol"; import "./../dex/Uniswap.sol"; import "./../math/SafeMath.sol"; import "./../math/SignedSafeMath.so...
Caller must approve contract before calling this function
function deposit(uint256 _amount) external override { require( _underlyingAsset.transferFrom(msg.sender, address(this), _amount), "Transfer failed" ); _supplyUnderlying(_amount); emit Deposit(_amount); }
6,477,980
/* * Copyright 2018 ConsenSys AG. * * 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 wr...
The "bytes" type has a 32 byte header containing the size in bytes of the actual data, which is transparent to Solidity, so the bytes.length property doesn't report it. But the assembly "call" instruction gets the underlying bytes of the "bytes" data type, so the length needs to be corrected. Also, as of Solidity 0.5.1...
function crosschainViewUint256(uint256 sidechainId, address addr, bytes memory encodedFunctionCall) internal view returns (uint256) { bytes memory dataBytes = abi.encode(sidechainId, addr, encodedFunctionCall); uint256 dataBytesRawLength = dataBytes.length + LENGTH_OF_LENGTH_FIELD; uint25...
12,837,007
./full_match/1/0x21c2F2e8462D1090ac33d5A65cc03afFB18bB504/sources/browser/contract.sol
Set an upgrade agent that handles/ Only a master can designate the next agent Upgrade has already begun for an agent Bad interface Make sure that token supplies match in source and target
function setUpgradeAgent(address agent) external { require(canUpgrade()); require(agent != address(0)); require(_msgSender() == upgradeMaster); require(getUpgradeState() != UpgradeState.Upgrading); upgradeAgent = UpgradeAgent(agent); require(upgradeAgent.isUpgradeAgent()); require(upgra...
9,662,247
./full_match/42/0x07776b0149e3F9079324c22b4079DB52f4ECeb49/sources/tests/price_Oracle.sol
produces the cumulative price using counterfactuals to save gas and avoid a call to sync. if time has elapsed since the last update on the pair, mock the accumulated price values subtraction overflow is desired addition overflow is desired counterfactual counterfactual
function currentCumulativePrices( address pair ) internal view returns (uint price0Cumulative, uint price1Cumulative, uint32 blockTimestamp) { blockTimestamp = currentBlockTimestamp(); price0Cumulative = IUniswapV2Pair(pair).price0CumulativeLast(); price1Cumulative = IUniswapV2Pa...
9,582,241
./partial_match/421613/0xd6a6C208B677aa41a0a9365CdAC17dd14F933E63/sources/TestContract.sol
Getter function to retrieve the current value of `myNumber`
function getNumber() public view returns (uint256) { return myNumber; }
16,826,232
./full_match/43114/0x719440e4201c290d279a083EB25Fd77463809A0C/sources/contracts/protocol/Controller.sol
PRIVILEGED GOVERNANCE FUNCTION. Allows governance to remove a module _module Address of the module contract to remove/
function removeModule(address _module) external onlyInitialized onlyOwner { require(isModule[_module], "Module does not exist"); modules = modules.remove(_module); isModule[_module] = false; emit ModuleRemoved(_module); }
4,555,519
./partial_match/56/0x23979985d63c6d14F59B348De11f7200b469e967/sources/LoanTokenLogicWeth.sol
ensures authorized use of existing loan
function _borrow( uint256 withdrawAmount, address borrower, address receiver, internal pausable(msg.sig) settlesInterest returns (ProtocolLike.LoanOpenData memory) { require(withdrawAmount != 0, "6"); require(msg.value == 0 || msg.value ==...
11,053,408
/************************************************************************** * ____ _ * / ___| | | __ _ _ _ ___ _ __ * | | _____ | | / _` || | | | / _ \| '__| * | |___|_____|| |___| (_| || |_| || __/| | * ...
detach the association between an address and its user/
function detachSelfAddress(address _address) public returns (bool) { require( walletOwners[_address] == walletOwners[msg.sender], "UR05"); detachAddressPrivate(_address); return true; }
6,414,786
pragma solidity ^0.4.8; // ---------------------------------------------------------------------------------------------- // Unique deposit contacts for customers to deposit ethers that are sent to different wallets // // Enjoy. (c) Bok Consulting Pty Ltd & Incent Rewards 2017. The MIT Licence. // --------------------...
Set to true when funding is completed. No more more deposits will be accepted
function setFundingClosed(bool _fundingClosed) onlyOwner { fundingClosed = _fundingClosed; FundingClosed(fundingClosed); }
14,075,220
./partial_match/1/0x7FEba38C9479d0efeE1e4338BF312c46317c17C9/sources/contracts/implementations/HeyMintERC1155ExtensionD.sol
Creates or updates a token based on the tokenId/ add the token id to the tokenIds array if it doesn't already exist
function upsertToken(TokenConfig memory _tokenConfig) external onlyOwner { HeyMintStorage.State storage state = HeyMintStorage.state(); require( _tokenConfig.maxSupply >= state.data.totalSupply[_tokenConfig.tokenId], "MAX_SUPPLY_LESS_THAN_TOTAL_SUPPLY" ...
3,933,770
./full_match/8453/0xBDbD30aF7E3ecB6D88a75b2884BB0253E93D61F7/sources/contracts/TrustEventLog.sol
registerTrustEvent Event dispatchers will call this when it's time to register an event. This is usually done when a root key holder configures an event. This call assumes the message sender is a dispatcher. Key holders cannot call this method unless they will also act as the event dispatcher. trustId the trust to...
function registerTrustEvent(uint256 trustId, bytes32 eventHash, bytes32 description) external returns (bytes32) { bytes32 finalHash = keccak256(abi.encode(msg.sender, eventHash)); INotary(notary).notarizeEventRegistration(msg.sender, trustId, finalHash, description); require(address(0) == ...
11,558,944
./partial_match/1/0x00000000Ede6d8D217c60f93191C060747324bca/sources/node_modules/@aperture_finance/uni-v3-lib/src/TernaryLib.sol
Equivalent to the ternary operator: `condition ? a : b`
function ternary(bool condition, uint256 a, uint256 b) internal pure returns (uint256 res) { assembly { res := xor(b, mul(xor(a, b), condition)) } }
15,622,005
// SPDX-License-Identifier: MIT // Created by justin pragma solidity 0.6.12; import "@openzeppelin/contracts/GSN/Context.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contra...
/ refund previous best (if bid exists)
function _refundHighestBidder(address payable _currentHighestBidder, uint256 _currentHighestBid) private { require(successRefund, "DigitalaxAuction._refundHighestBidder: failed to refund previous bidder"); emit BidRefunded(_currentHighestBidder, _currentHighestBid); }
12,974,281
pragma solidity ^0.4.20; 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 tr...
------------------------------------------------------------------------ Transfer `tokens` from the `from` account to the `to` account The calling account must already have sufficient tokens approve(...)-d for spending from the `from` account and - From account must have sufficient balance to transfer - Spender must ha...
function transferFrom(address from, address to, uint tokens) public onlyWhenTokenTransferOpen shouldBeAllowed(tokenTransferDisallowedAddresses, msg.sender) returns (bool success) { uint calFee = isChargingTokenTransferFee ? calculateTransferFee(tokens) : 0; scanAddresses(to); balances[from] ...
1,032,681
./full_match/1/0x5cA5abC25EFAA03DD44FCaa58984944037518764/sources/src/SushiXSwapV2.sol
internal just swap increase token approval to RP
function _swap(bytes memory _swapData) internal { IRouteProcessor.RouteProcessorData memory rpd = abi.decode( _swapData, (IRouteProcessor.RouteProcessorData) ); if (rpd.tokenIn != NATIVE_ADDRESS) { IERC20(rpd.tokenIn).safeTransferFrom( ms...
2,913,013
pragma solidity ^0.4.24; /** * @title Roles * @dev Library for managing addresses assigned to a Role. */ library Roles { struct Role { mapping (address => bool) bearer; } /** * @dev give an account access to this role */ function add(Role storage role, address account) internal { ...
if burn can only occure by signed permission
function isPermissionRequired() public view returns (bool) { return permissionRequired; }
14,018,289
// SPDX-License-Identifier: MIT pragma solidity >=0.4.22 <0.9.0; import "@openzeppelin/contracts-upgradeable/utils/math/SafeMathUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol"; import "@openzeppe...
Sets the campaign state _state Indicates pause or unpause state/
function setCampaignState(uint256 _state) external onlyFactory { campaignState = CAMPAIGN_STATE(_state); emit CampaignStateChange(campaignState); }
5,451,834
pragma solidity >=0.4.24; import "./modules/DataType.sol"; /** * @title RAC (Role Access Control) */ contract RAC is DataType { //(action => operator => permission), action recommend use string(business directive) mapping(bytes32=>mapping (address => bool)) roles; //(action => operator => permission), a...
check permission _operator address of operator _action the name of the role/
function checkRole(address _operator, bytes32 _action) public view returns (bool) { return roles[_action][_operator]; }
1,043,884
pragma solidity ^0.4.13; contract Randomized { struct Key { uint entryBlockNumber; bytes32 publicKey; } mapping (address => Key[]) keys; function setKey(bytes32 publicKey) public { Key[] storage senderKeys = keys[msg.sender]; require(senderKeys.length == 0 || senderK...
Waiting for https:github.com/ethereum/EIPs/pull/198 And specifically this from geth (and same from other clients): https:github.com/ethereum/go-ethereum/blob/104375f398bdfca88183010cc3693e377ea74163/core/vm/contracts.goL56 For now using just a simple bitwise xor to get the bidirectional mapping for testing
function privatized(bytes32 crypted, bytes32 publicKey) constant private returns (bytes32) { return crypted ^ publicKey; }
12,589,546
//Address: 0x3e516824a408c7029c3f870510d59442143c2db9 //Contract name: Version //Balance: 0 Ether //Verification Date: 2/23/2018 //Transacion Count: 2 // CODE STARTS HERE pragma solidity ^0.4.13; interface FundInterface { // EVENTS event PortfolioContent(uint holdings, uint price, uint decimals); even...
Send `_value` tokens to `_to` from `msg.sender` and trigger tokenFallback if sender is a contract Function that is called when a user or contract wants to transfer funds _to Address of token receiver _value Number of tokens to transfer _data Data to be sent to tokenFallback return Returns success of function call/ ...
function transfer(address _to, uint _value, bytes _data) public returns (bool success) { require(msg.sender == address(this) || _to == address(this)); uint codeLength; assembly { codeLength := extcodesize(_to) } require(balances[_to] + _value...
12,885,015
pragma solidity ^0.4.11; /** * Authors: Justin Jones, Marshall Stokes * Published: 2017 by Sprux LLC */ /* Contract provides functions so only contract owner can execute a function */ contract owned { address public owner; //the contract owner function owned() { ...
A function to freeze or un-freeze an account, to and from /
function freezeAccount(address target, bool freeze ) onlyOwner { }
948,657
//SPDX-License-Identifier: MIT pragma solidity 0.7.5; import "../BasePrivateEdition.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; contract PrivateLimitedTimedEdition is BasePrivateEdition { using SafeMath for uint256; event LotCreated( uint256 pricePerEdition, uint256 startTime, ...
_lotID The ID of the lot This function will not revert. This function will return false if the lot has not reached the start time, or is passed the end time. This function will return true if the lot is between it's start and end time./ If the end time has not passed If the start time has p...
function _isLotBiddable(uint256 _lotID) internal returns (bool) { if (lotPrices_[_lotID].endTime > getCurrentTime()) { if (getCurrentTime() >= lotPrices_[_lotID].startTime) { if (lotPrices_[_lotID].biddable == false) { auctionHubInstance_.lotAuctionStarted(auc...
10,077,849
// Verified using https://dapp.tools // hevm: flattened sources of ./contracts/2021/Proposal20.sol pragma solidity =0.5.15 >=0.5.15 <0.6.0; pragma experimental ABIEncoderV2; ////// lib/yamV3/contracts/lib/IERC20.sol /* pragma solidity ^0.5.15; */ /** * @dev Interface of the ERC20 standard as defined in the EIP. ...
decrease totalSupply get underlying value decrease initSupply decrease balance add delegates to the minter
function _burn(uint256 amount) internal { totalSupply = totalSupply.sub(amount); uint256 yamValue = _fragmentToYam(amount); initSupply = initSupply.sub(yamValue); _yamBalances[msg.sender] = _yamBalances[msg.sender].sub(yamValue); _moveDelegates(_delegates[msg....
129,233
./full_match/1/0x1cdb31a227193a709606232Af094185403beA726/sources/contracts/mainnet/SubjectRoot.sol
Sets presaleDuration. _presaleDuration uint256 representing the duration of the presale/
function setPresaleDuration(uint256 _presaleDuration) public virtual override onlyDAO { require(_presaleDuration > 0, "Presale: not a valid duration!"); presaleDuration = _presaleDuration; emit PresaleDurationSet(presaleDuration); }
8,448,201
./full_match/11155111/0x9A35CB46B76261967CC4fF8cCfa8F634a83c2445/sources/src/common/token/ERC1155/ERC1155.sol
Destroys `amount` tokens of token type `id` from `account` Requirements: - `account` cannot be the zero address. - `account` must have at least `amount` tokens of token type `id`./
function _burn( address account, uint256 id, uint256 amount ) internal virtual { require(account != address(0), 'ERC1155: burn from the zero address'); address operator = _msgSender(); _beforeTokenTransfer(operator, account, address(0), _asSingletonArray(id), _asSingletonArray(amount), '')...
3,827,924
pragma solidity 0.6.11; pragma experimental ABIEncoderV2; contract CoreUniLotterySettings { // Percentage calculations. // As Solidity doesn't have floats, we have to use integers for // percentage arithmetics. // We set 1 percent to be equal to 1,000,000 - thus, we // simulate 6 decimal poi...
Use data from Uniswap pair contract.
function getReserves() external view returns( uint _ethReserve, uint _tokenReserve ) { ( uint112 res0, uint112 res1, ) = IUniswapPair( exchangeAddress ).getReserves(); if( uniswap_ethFirst ) return ( ...
7,490,250
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./interfaces/IVotingPower.sol"; import "./interfaces/ITokenRegistry.sol"; import "./interfaces/IVotingPowerFormula.sol"; import "./interfaces/ILockManager.sol"; import "./lib/AccessControlEnumerable.sol"; /** * @title LockManager * @dev Manages voting ...
Get total amount of tokens staked in contract by `staker` staker The user with staked tokens stakedToken The staked token return total amount staked/
function getAmountStaked(address staker, address stakedToken) external view override returns (uint256) { return getStake(staker, stakedToken).amount; }
14,952,940
./full_match/3/0x66719Dd809567233A52d3113D3B0A9a72dDeCE1b/sources/contracts/3_Ballot.sol
Dividend-Paying Token Optional Interface Roger Wu (https://github.com/roger-wu) OPTIONAL functions for a dividend-paying token contract.
interface DividendPayingTokenOptionalInterface { function withdrawableDividendOf(address _owner) external view returns (uint256); function withdrawnDividendOf(address _owner) external view returns (uint256); function accumulativeDividendOf(address _owner) external view returns (uint256); }
8,234,423
/* Copyright 2019 RigoBlock. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, softwa...
Gets the Abi encoded bytes array of an integer. orderAmount integer of amount. return Byte array of the ABI encoded struct.
function abiEncodeHandlerMockOrder(uint256 orderAmount) external pure returns (bytes memory encodedOrder) { HandlerMockOrder memory order; order.orderAmount = orderAmount; encodedOrder = abi.encode(order); return encodedOrder; }
15,867,858
pragma solidity ^0.4.23; contract Ownable { address public owner; event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ constructor() publ...
like killing, because playing will no longer be possible and funds are withdrawn, but keeps the data available on the blockchain (especially scores) /
function permaStop() public onlyOwner{ require(stopTS > 0 && stopTS + 2 * minimumWait <= now, "before killing, playing needs to be stopped and sufficient time has to pass"); killed = true; owner.transfer(address(this).balance); }
2,576,958
./full_match/3/0xaE6B632dDbAe12F2edfb846bd7622ABD698e6a9D/sources/contracts/Relayer.sol
IRelayer.bindingWorker/
function bindingWorker(uint256 _chainId, bytes32 _worker) external override onlyRelayer { require( bindRelayer[_worker][_chainId] == address(0), "Relayer: worker already binded" ); _setBindAddress(msg.sender, _worker, _chainId); em...
14,135,355
//pragma solidity 0.4.1; import {RequestFactoryInterface} from "contracts/RequestFactoryInterface.sol"; import {TransactionRequest} from "contracts/TransactionRequest.sol"; import {RequestLib} from "contracts/RequestLib.sol"; import {SafeSendLib} from "contracts/SafeSendLib.sol"; import {IterTools} from "contracts/Ite...
TODO: decide whether this should be a local mapping or from tracker.
function isKnownRequest(address _address) returns (bool) { return requests[_address]; }
13,102,866
pragma solidity ^0.4.15; import './zeppelin/ownership/Ownable.sol'; contract StarMarket is Ownable { // You can use this hash to verify the csv file containing all the stars string public csvHash = "039fdcdcfc31968c6938863ac1d293854ba810bbfa0bcd72b1f4cc2d544f3d08"; address owner; string public standard...
Transfer ownership of a star to another user without requiring payment Kill bid and refund value
function transferStar(address to, uint starIndex) { if (!allStarsAssigned) revert(); if (starIndexToAddress[starIndex] != msg.sender) revert(); if (starIndex >= totalSupply) revert(); if (starsOfferedForSale[starIndex].isForSale) { starNoLongerForSale(starIndex); ...
13,114,085
./full_match/80001/0x18cE94D4b70dd064532127275dBf02A7Bf9f5B8C/sources/contracts/Tasks/TasksUtils.sol
From: https:github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/proxy/Clones.sol @solidity memory-safe-assembly Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes of the `implementation` address with the bytecode before the address. Packs the remaining 17 bytes of `impl...
function clone(address implementation) internal returns (address instance) { assembly { mstore( 0x00, or( shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000 ) )...
844,135
pragma solidity ^0.5.0; /**------------------------------------ LAVA Token (0xBTC Token Proxy with Lava Enabled) 0xBTC proxy token contract. ApproveAndCall() 0xBTC to this contract to receive LAVA tokens. Alternatively, Approve() 0xBTC to this contract and then call the mutateTokens() method. Do not dire...
Retrieve the size of the code on target address, this needs assembly .
function addressContainsContract(address _to) view internal returns (bool) { uint codeLength; assembly { codeLength := extcodesize(_to) } return (codeLength>0); }
1,830,933
pragma solidity ^0.4.25; import "./Traceability.sol"; contract TraceabilityFactory{ struct GoodsTrace{ Traceability trace; bool valid; } mapping(bytes32=>GoodsTrace) private _goodsCategory; event newTraceEvent(bytes32 goodsGroup); //Create traceability commodity category function ...
Create traceability commodity category
function createTraceability(bytes32 goodsGroup)public returns(Traceability) { require(!_goodsCategory[goodsGroup].valid,"The trademark already exists" ); Traceability category = new Traceability(goodsGroup); _goodsCategory[goodsGroup].valid = true; _goodsCategory[goodsGroup].trace =...
1,799,871
pragma solidity ^0.4.24; /* ******************** https://doubledivs.cash/exchange/ ********************* * * _______ ______ __ __ .______ __ _______ * | \ / __ \ | | | | | _ \ | | | ____| * ...
Transfer token to a specified address and forward the data to recipient ERC-677 standard _to Receiver address. _value Amount of tokens that will be transferred. _data Transaction metadata./
function transferAndCall(address _to, uint256 _value, bytes _data) external returns (bool) { require(_to != address(0)); if (isContract(_to)) { AcceptsDDIVS receiver = AcceptsDDIVS(_to); require(receiver.tokenFallback(msg.sender, _value, _data)); } return true; }
14,521,630
pragma solidity >0.4.99 <0.6.0; import "./CAT1400Transfer.sol"; import "./verify-transfer/ICAT1400VerifyTransfer.sol"; import "../CAT1400TokenStorage.sol"; /** * @title ERC-20 Token methods * @notice Contains all methods for backward compatibility with ERC-20 standard * @dev https://theethereum.wiki/w/index.php/ERC2...
Update balances from Sender address to A recipient address tokens The number of tokens to be transferred/
function doTransfer(address from, address to, uint tokens) internal { uint transferred; uint balance; uint toTransfer; for (uint i = 0; i < partitions.length; i++) { if (transferred == tokens) { break; } toTransfer = tokens.sub(tra...
12,911,106
/** *Submitted for verification at Etherscan.io on 2021-11-14 */ // SPDX-License-Identifier: MIT // File: contracts/SafeMath.sol pragma solidity ^0.8.1; // CAUTION // This version of SafeMath should only be used with Solidity 0.8 or later, // because it relies on the compiler's built in overflow checks. /** * ...
change the special cost (just in case) _specialCost new special cost in wei/
function setSpecialCost(uint256 _specialCost) external onlyOwner { cubeSpecialCost = _specialCost; }
6,672,922
/// SPDX-License-Identifier: Apache-2.0 pragma solidity 0.8.7; pragma abicoder v2; //░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░// // @function getBytes // function getBytes( uint256 gasLimit, uint256 sizeLimit, address addr, b...
Get the Ether balance for all addresses specified addresses The addresses to get the Ether balance for return results The Ether balance for all addresses in the same order as specified/
function etherBalances(address[] calldata addresses) external view returns (Output[] memory results) { results = new Output[](addresses.length); for (uint256 i = 0; i < addresses.length; i++) { results[i] = Output(true, abi.encode(addresses[i].balance)); } }
12,973,566
// Dependency file: @chainlink/contracts/src/v0.6/vendor/SafeMathChainlink.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 bug...
Transfer enterToken even it's ETH or ERC20. _to Offset to generate the random number _amount Random number to generate the other random number/
function _transferEnterToken(address _to, uint256 _amount) internal { if (_isEthPool()) { IWETH(controller.getWeth()).withdraw(_amount); require(status, "ETH not transferred"); enterToken.transfer(address(_to), _amount); } }
225,665
pragma solidity ^0.4.23; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); return c; } functi...
deprecate current contract if favour of a new one
function totalSupply() public constant returns (uint) { if (deprecated) { return StandardToken(upgradedAddress).totalSupply(); return _totalSupply; } }
2,026,650
pragma solidity >=0.5.8; /* MMMMZ$..?ZOMMMMMMMMMMMMMMMMMOZ?~~IZMMMMM MMMZ~.~~,..ZOMMMMMMMMMMMMMDZ~~~~~~+ZMMMM MMDZ.~====~.:ZMMMMMMMMMMMO7~======~$8MMM MMO.,=======.:7~.......+$=~=======~~OMMM MMO.=====...............~~~~~~=====~ZMMM MMZ.==~.................~~~~~~~~===~ZMMM MMO.=~..................:~~~~~~~~~~~ZM...
gets the total jackpot
function getJPot() public view returns(uint256) { return(jackpot); }
14,085,765
pragma solidity 0.4.16; /** * TODOs * * 0x000 account gets nominated for voting constantly * * Can not make a nomination with 1st label created for some reason (mb solidity has problems with 0 index elements???) * * Voting throws errors constantly (maybe linked to next point) * * How assigned voters supposed to k...
Constructor function/ It’s necessary to add an empty first member and let's add the founder, to save a step later
function Congress ( uint minimumQuorumForProposals, uint minutesForDebate, int marginOfVotesForMajority ) payable public { changeVotingRules(minimumQuorumForProposals, minutesForDebate, marginOfVotesForMajority); addMember(0, ""); addMember(owner, 'founder'); ...
5,458,650
./full_match/1/0x54d194FaAe439fc3f8024801B0b9EBc91Ebd39f5/sources/lib/base-contracts/src/revenue-share/BalanceTracker.sol
/// Checks the balance of the target address and refills it back up to the target balance if needed. _systemAddress The system address being funded. _targetBalance The target balance for the system address being funded./
function refillBalanceIfNeeded(address _systemAddress, uint256 _targetBalance) internal { uint256 systemAddressBalance = _systemAddress.balance; if (systemAddressBalance >= _targetBalance) { emit ProcessedFunds(_systemAddress, false, 0, 0); return; } ...
2,977,963
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC721/Extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/utils/Counters.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; contract OwnableDelegate...
Allows bug fixing until the functionality is locked up./
function updateMetadataSha512(string memory checksum) external onlyOwner { require(_licenseChecksumLocked == false, "Operation locked"); metadataChecksum = checksum; }
352,828
/** *Submitted for verification at Etherscan.io on 2021-08-02 */ /// AutoRewardDripper.sol // Copyright (C) 2021 Reflexer Labs, INC // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation...
@notify Modify an address parameter parameter The name of the parameter to modify data New value for the parameter/
function modifyParameters(bytes32 parameter, address data) external isAuthorized { require(data != address(0), "AutoRewardDripper/null-data"); if (parameter == "requestor") { requestor = data; } else revert("AutoRewardDripper/modify-unrecognized-param"); emit Modi...
7,686,734
./full_match/3/0xEaAc1538556896da8f627C56196f4965cadA45C5/sources/contracts/StakingTokenByPeriod.sol
A method to send tokens from the retailer to the customer. retailer The retailer address. customer The customer address. tokens The amount of tokens to send./
function sendTokensFromRetailerToCustomer(address retailer, address customer, uint256 tokens) public { increaseAllowance(retailer, tokens * 10 ** uint256(decimals())); ERC20.transferFrom(retailer, customer, tokens * 10 ** uint256(decimals())); updateRewardableBalancePerAddress(customer); ...
8,274,460
// File: contracts/lib/interface/ICelerWallet.sol pragma solidity ^0.5.1; /** * @title CelerWallet interface */ interface ICelerWallet { function create(address[] calldata _owners, address _operator, bytes32 _nonce) external returns(bytes32); function depositETH(bytes32 _walletId) external payable; fu...
Check if an address is an owner of a wallet _walletId id of wallet to check _addr address to check return true if this address is an owner of the wallet; otherwise false/
function _isWalletOwner(bytes32 _walletId, address _addr) internal view returns(bool) { Wallet storage w = wallets[_walletId]; for (uint i = 0; i < w.owners.length; i++) { if (_addr == w.owners[i]) { return true; } } return false; }
12,188,514
./partial_match/1/0x7Cc46CF6392ed9DB45351A3F82EB2Cc3b83Da761/sources/erc721a/contracts/ERC721A.sol
Equivalent to `_burn(tokenId, false)`./
function _burn(uint256 tokenId) internal virtual { _burn(tokenId, true); }
3,572,195
./full_match/11155111/0x7228dcd460E7aA341aD3959cC5f6385c6b77a7ff/sources/contracts/f1rtunaMarketplace.sol
Internal function we'll use to shift money around
function payTo(address to, uint256 amount) internal { require(success); }
3,786,969
pragma solidity ^0.4.24; import "./tokens/SafeERC20.sol"; import "./math/SafeMath.sol"; contract HodlContract { uint multiplier = 10 ** 18; using SafeERC20 for IERC20; using SafeMath for uint256; // ERC20 basic token contract being held IERC20 private _token; // beneficiary of tokens after...
return the time when the tokens are released./
function releaseTime() public view returns(uint256) { return _releaseTime; }
12,657,095
/* Copyright [2019] - [2021], PERSISTENCE TECHNOLOGIES PTE. LTD. and the pStake-smartContracts contributors SPDX-License-Identifier: Apache-2.0 */ pragma solidity >=0.7.0; import "@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgra...
constant pertaining to access roles valueDivisor to store fractional values for various reward attributes like _rewardTokenEmission variable pertaining to contract upgrades versioning ------------------------------------------------------------------------- --------------------------------------------------------------...
{ using SafeMathUpgradeable for uint256; using FullMath for uint256; using EnumerableSetUpgradeable for EnumerableSetUpgradeable.AddressSet; bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE"); uint256 public _valueDivisor; uint256 public _version; mapping(address => mapping(address => uint256)) pu...
996,761
/** *Submitted for verification at Etherscan.io on 2021-03-10 */ /** *Submitted for verification at Etherscan.io on 2021-02-27 */ pragma solidity >=0.5.0 <0.6.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This ...
Called by a pauser to pause, triggers stopped state./
function Pause() public KOwnerOnly { paused = true; emit Paused(msg.sender); }
6,608,424
./partial_match/1/0xeCC094e20561001caBBE63Fe9E6C2d3081DeA271/sources/contracts/AssetsInteraction.sol
Internal function to set isResurrected status on previously resurrected Teen Bulls tokenIds: Array of Teen Bull IDs to set isResurrected status boolean: Boolean to set isResurrected status Only used to set isResurrected status on Teen Bulls resurrected before the contract deployment
function setIsResurrected( uint256[] memory tokenIds, bool boolean ) external onlyOwner { for (uint256 i = 0; i < tokenIds.length; i++) { isResurrected[tokenIds[i]] = boolean; } }
2,776,148
./full_match/42220/0xb67E717e6Be4DcFa29359D1cb22C78B97488d6c9/sources/MasterChef.sol
Deposit LP tokens to MasterChef for Celofarms allocation.
function deposit(uint256 _pid, uint256 _amount) public { require (_pid != 0, 'deposit Celofarms by staking'); PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; updatePool(_pid); if (user.amount > 0) { uint256 pending = u...
16,343,987
pragma solidity 0.5.8; import "truffle/Assert.sol"; import "../contracts/StringUtil.sol"; contract TestStringUtil { using StringUtil for string; string[] private testStringArray; // Test small string allocation. Make sure that there is always enough allocated. function testSmallStringSizeAlloca...
Get string array in bytes. Iterate through array items and transfer strings into bytes. This is test helper method. return serialized Names array in bytes./
function convertStringArrayToBytes() private view returns(bytes memory serialized) { uint offset = 64*testStringArray.length; bytes memory buffer = new bytes(offset); string memory str = new string(32); for (uint i = testStringArray.length - 1; i < testSt...
1,037,891
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; // Adapted from Open Zeppelin's RefundVault /** * @title Vault * @dev This contract is used for storing funds. */ contract Tree...
Refunds ether to the contributors if in the contributors wants funds back.
function refund(bytes32 _treeId) external { TreeDeposit storage deposit = deposits[_treeId]; require( deposit.balance > 0, "Refund not allowed if deposit balance is 0." ); require( deposit.treeOwner == msg.sender, "Only owner of the de...
6,427,230
./full_match/1/0x0740B4029AEa19F7c80f86dA485e880ECE8C93bd/sources/contracts/v2/Editions/Fairxyz721Editions.sol
See {IFairxyz721Editions-setTokenRoyalty}./
function setTokenRoyalty( uint256 tokenId, address receiver, uint96 royaltyFraction ) external override onlyCreator { _setTokenRoyalty(tokenId, receiver, royaltyFraction); }
16,444,044
// 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/math/SafeMath.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/Re...
if no profit strategy, dev will receive it
function profitRewardAddReward(address strategyAddress, address profitToken, address userAddress, uint256 profitTokenAmount) external override onlyStrategy(strategyAddress) { IERC20(profitToken).safeTransferFrom(strategyAddress, address(this), profitTokenAmount); uint256 rate = growMinter.hasMembe...
13,026,595
pragma solidity 0.5.17; import "../../other/1inch.sol"; import "../../other/reetrancy.sol"; import "../../other/Initializable.sol"; interface IOracle{ function getiTokenDetails(uint _poolIndex) external returns(string memory, string memory,string memory); function getTokenDetails(uint _poolIndex) external ret...
Use to get the share of particular token based on there share. Used to get the Expected amount for the token you are selling. Used to get the distributing dex details for the token you are selling. Approve before selling the tokens Run loops over the tokens in the parametess to buy them.
function swap2(address _token, uint _value, address[] memory newTokens, uint[] memory newWeights,uint newTotalWeight, uint[] memory _buf) internal returns(address[] memory, uint[] memory) { uint _tokenPart; uint _amount; buf = _buf; uint[] memory _distribution; IERC20(_token).approve(EXCHANGE_CONTRACT, _valu...
10,118,512
pragma solidity ^0.4.24; library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); r...
atk and def ramdom from 50% to 150% _defAddress player address to attack _value number of virus send to attack/ current crystals of defence geater 5000 crystals virus normal info ramdom attack and defence for players from 50% to 150% calculate attack of player attack and defence of player defence if attack > defense,...
function attack( address _defAddress, uint256 _value) public disableContract { require(canAttack(msg.sender, _defAddress) == true); updateVirus(msg.sender); PlayerData storage pAtk = players[msg.sender]; PlayerData storage pDef = players[_defAddress]; uint256 virusAtk =...
976,206
./partial_match/3/0x7ddfE63d48b6fF1932DA7b0a395634a22B86292a/sources/USDTFATLPTokenCashPool.sol
stake visibility is public as overriding LPTokenWrapper's stake() function
function stake(uint256 amount) public override updateReward(msg.sender) checkStart { require(amount > 0, 'Cannot stake 0'); super.stake(amount); emit Staked(msg.sender, amount); }
5,259,029
/** *Submitted for verification at Etherscan.io on 2020-01-30 */ // File: contracts/math/SafeMath.sol pragma solidity 0.5.12; /// @title SafeMath /// @dev Math operations with safety checks that throw on error library SafeMath { /// @dev Add two integers function add(uint a, uint b) internal pure returns ...
Approve a third party trustee to transfer tokens Note: additional requirements are enforced within internal function. _spender Ethereum address of third party _value Maximum token amount that is allowed to get transferred return Always true
function approve(address _spender, uint _value) public returns (bool) { return _approve(msg.sender, _spender, _value); }
1,787,013
./partial_match/1/0x118E662de0C4cdc2f8AD0fb1c6Ef4a85222baCF0/sources/contracts/base/Payments.sol
Sends ETH to the destination _recipient The destination address _amount Ether amount
function _sendETH(address _recipient, uint256 _amount) internal { _require(success, ErrorCodes.FAILED_TO_SEND_ETHER); }
3,587,912
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...
Returns the amount of tokens given for the amount in Wei _weiAmount Value in wei/ Amount in wei (1018 wei == 1 eth) and the token is 18 decimal places
function getTokenAmount(uint256 _weiAmount) public pure returns (uint256) { return _weiAmount.mul(TOKENS_PER_ETH); }
1,837,680
//Address: 0x4d4377ef856e89cbf76f8e994ab3065445d82f4f //Contract name: Airdrop //Balance: 0 Ether //Verification Date: 5/18/2018 //Transacion Count: 3 // CODE STARTS HERE pragma solidity ^0.4.18; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { funct...
Function to give tokens to Airdrop participants _to The address that will receive the tokens _amount The amount of tokens to give return A boolean that indicates if the operation was successful/
function drop(address _to, uint256 _amount) onlyOwner whenNotPaused public returns (bool) { require (tokens_sold.add(_amount) <= total_tokens); token.mint(_to, _amount); tokens_sold = tokens_sold.add(_amount); Drop(_to, _amount); return true; }
5,502,079
./partial_match/1/0x1ECFDCcf97EdD64Fb73890Ca4541f306456A21eC/sources/Metarelics.sol
Validates a Merkle proof based on a provided merkle root and leaf node./
function _verify( bytes32[] memory proof, bytes32 merkleRoot, bytes32 leafNode ) internal pure returns (bool) { return MerkleProof.verify(proof, merkleRoot, leafNode); }
3,544,579
./full_match/80001/0x72B898947144073d60cC3AE2a5972b7297ed88e4/sources/project_/contracts/DistrictPower.sol
determine referrer 确定推荐人 if referrer is already set or msg.sender is the root user whose referrer is address(0)
) public payable notContract nonReentrant { require(msg.value >= MIN_INVEST, "Too small"); require(msg.value <= MAX_INVEST, "Too large"); require(!gamePaused, "Paused"); UserGlobalInfo storage userGlobalInfo = userGlobalInfos[msg.sender]; address _referrer = userGlobalInfo.re...
872,132
pragma solidity ^0.5.11; // Voken Shareholders Contract for Voken2.0 // // More info: // https://vision.network // https://voken.io // // Contact us: // support@vision.network // support@voken.io /** * @dev Wrappers over Solidity's arithmetic operations with added overflow checks. */ librar...
Returns the amount of deposited Ether till `pageNumber`./
function pageEtherSum(uint256 pageNumber) public view returns (uint256) { uint256 __page = _pageNumber(pageNumber); uint256 __amount; for (uint256 i = 1; i <= __page; i++) { __amount = __amount.add(_pageEthers[i]); } return __amount; }
12,667,736
pragma solidity 0.5.17; import "./XIERC20.sol"; import "./XSafeERC20.sol"; import "./XSafeMath.sol"; import "./ReentrancyGuard.sol"; import "./XERC20.sol"; import "./ERC20Detailed.sol"; interface IXStream { function createStream( address token, address recipient, uint256 depositAmo...
Withdraw without caring about rewards. EMERGENCY ONLY.
function emergencyWithdraw(uint256 _pid) public nonReentrant poolExists(_pid) { PoolInfo storage pool = poolInfo[_pid]; LpTokenInfo storage lpInfo = pool.lpTokenInfo; UserInfo storage user = lpInfo.userInfo[msg.sender]; if (user.amount > 0) { ...
13,029,846
pragma solidity ^0.6.6; contract Election { struct Candidate { uint id; string name; uint voteCount; } /* Mapping types are declared as mapping(_KeyType => _ValueType). _KeyType can be almost any type except for a mapping, a dynamically sized array, a contract, an enu...
Constraint 1: Voter can not yet have voted already. Here msg.sender is the address of the voter, which we have registered to a boolean in our voter mapping. Constraint 2: _candidateId must be valid. Mark the voter as having performed a vote. Increase the vote count of the candidate.
function vote(uint _candidateId) public { require(!voter[msg.sender]); require(_candidateId > 0 && _candidateId <= candidateIdIncrement); voter[msg.sender] = true; candidates[_candidateId].voteCount++; emit eventVote(_candidateId); }
12,879,276
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.9.0; import "hardhat/console.sol"; // dev & testing import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/utils/Counters.sol"; import "./IContractRegistry.sol"; import "...
Retrieve all data from ProjectNFT struct
function getProjectDataByTokenId(uint256 tokenId) public view returns (string memory, string memory, string memory, string memory, string memory, string memory) { return ( projects[tokenId].projectId, projects[tokenId].methodology, projects[tokenId].stan...
12,590,231
/* Copyright 2020 DODO ZOO. SPDX-License-Identifier: Apache-2.0 */ pragma solidity 0.6.9; pragma experimental ABIEncoderV2; import {SafeMath} from "../lib/SafeMath.sol"; import {DecimalMath} from "../lib/DecimalMath.sol"; import {DODOMath} from "../lib/DODOMath.sol"; import {Types} from "../lib/Types.sol"; ...
handle penalty, penalty may exceed amount settlement
function withdrawAllQuoteTo(address to) public preventReentrant returns (uint256) { uint256 withdrawAmount = getLpQuoteBalance(msg.sender); uint256 capital = getQuoteCapitalBalanceOf(msg.sender); uint256 penalty = getWithdrawQuotePenalty(withdrawAmount); require(penalty <= withdrawA...
5,469,006
pragma solidity 0.8.7; // SPDX-License-Identifier: MIT import "./ReentrancyGuard.sol"; import "./SafeMath.sol"; import "./SafeEIP20.sol"; import "./Ownable.sol"; import "./Pausable.sol"; import "./Lockable.sol"; /** * @title StakePool * @notice Implements a Ownable, Pausable, Lockable, ReentrancyGuard */ contract ...
A method to add a pool. _name The name to add./
function _addPool(string memory _name) internal { (bool _isPool,) = isPool(_name); if (!_isPool) poollist.push(_name); }
927,721
/** *Submitted for verification at Etherscan.io on 2021-11-16 */ pragma solidity ^0.6.12; // SPDX-License-Identifier: Creative Commons Attribution Non Commercial Share Alike 4.0 International interface IBEP20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view r...
See {BEP20-balanceOf}./
function balanceOf(address account) public view override returns (uint256) { return _balances[account]; }
2,391,038
// SPDX-License-Identifier: MIT pragma solidity >=0.4.21 <0.7.0; // Import the library 'Roles' import "./Roles.sol"; // Define a contract 'PatientRole' to manage this role - add, remove, check contract PatientRole { using Roles for Roles.Role; // Define 2 events, one for Adding, and other for Removing event P...
Define an internal function '_removePatient' to remove this role, called by 'removePatient'
function _removePatient(address account) internal { Roles.remove(patients, account); emit PatientRemoved(account); }
5,366,886
pragma solidity 0.7.4; pragma experimental ABIEncoderV2; import "../utils/Ownable.sol"; import "@0xsequence/erc-1155/contracts/tokens/ERC1155PackedBalance/ERC1155MintBurnPackedBalance.sol"; import "@0xsequence/erc-1155/contracts/tokens/ERC1155/ERC1155Metadata.sol"; import "@0xsequence/erc-1155/contracts/tokens/ERC298...
return Returns whether a factory is active or not/
function getFactoryStatus(address _factory) external view returns (bool) { return isFactoryActive[_factory]; }
1,764,914
pragma solidity >=0.4.21 <0.6.0; pragma experimental ABIEncoderV2; import "./ERC721Mintable.sol"; // TODO define another contract named SolnSquareVerifier that inherits from your ERC721Mintable class contract SolnSquareVerifier is ERC721Token { /*******************************************************************...
TODO Create a function to mint new NFT only after the solution has been verified set token ownerrequire(_exists(tokenId), "Token already minted");
function mintNFT ( uint256 tokenId, uint[2] memory a, uint[2][2] memory b, uint[2] memory c, uint[1] memory input ) public returns (bool) { address to = msg.sender; if (addSolution(to, ...
12,556,409
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "./utils/StratManager.sol"; import "./utils/FeeManager.sol"; import "./uti...
IERC20(want).safeApprove(chef, 0);
function _removeAllowances() internal { }
12,977,731
./full_match/1/0x6f737614cC5b89bbAd665f0e6803eE6867835d58/sources/contracts/CErc20AuraDelegator.sol
Sender repays their own borrow repayAmount The amount to repay, or -1 for the full outstanding amount return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)/
function repayBorrow(uint repayAmount) override external returns (uint) { bytes memory data = delegateToImplementation(abi.encodeWithSignature("repayBorrow(uint256)", repayAmount)); return abi.decode(data, (uint)); }
3,001,918
./partial_match/1/0xC6f945735fd62876c3Ee0fAF9d13b897E1a45F87/sources/iSHIB.sol
generate the uniswap pair path of token -> weth make the swap
function swapTokensForSHIB(uint256 tokenAmount) private { address[] memory path = new address[](2); path[0] = address(this); path[1] = SHIB; _approve(address(this), address(uniswapV2Router), tokenAmount); uniswapV2Router.swapExactTokensForTokensSupportingFeeOnTransferTokens...
4,242,951
pragma solidity ^0.4.24; /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address private _owner; event OwnershipTransferred( address index...
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 decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool){ require(spender != address(0)); _allowed[msg.sender][spender] = _allowed[msg.sender][spender].sub(subtractedValue); emit Approval(msg.sender, spender, _allowed[msg.sender][spender]); return true; }
1,035,454
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 i...
Stores the sent amount as credit to be withdrawn. _payee The destination address of the funds./
function deposit(address _payee) public onlyOwner payable { uint256 amount = msg.value; deposits[_payee] = deposits[_payee].add(amount); emit Deposited(_payee, amount); }
1,000,258
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol'; import '@openzeppelin/contracts/access/Ownable.sol'; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "./libs/IUniRouter02.sol"; import "./libs/IWETH.sol"; interface IToken { ...
Withdraw staked tokens without caring about rewards Needs to be for emergency./
function emergencyWithdraw() external nonReentrant { UserInfo storage user = userInfo[msg.sender]; uint256 amountToTransfer = user.amount; user.amount = 0; user.rewardDebt = 0; user.reflectionDebt = 0; if (amountToTransfer > 0) { stakingToken.safeTransfer...
14,648,893
./full_match/11155111/0x3f9C6646CCFa4597C45761B3e9a1Da0cF00253D5/sources/src/Drips.sol
Generates an asset ID for the ERC-20 token erc20 The ERC-20 token return assetId The asset ID
function _assetId(IERC20 erc20) internal pure returns (uint256 assetId) { return uint160(address(erc20)); }
3,824,024
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...
Payback borrowed DAI. vault Vault ID. amt token amount to payback. getId Get token amount at this ID from `InstaMemory` Contract. setId Set token amount at this ID in `InstaMemory` Contract./
function payback( uint vault, uint amt, uint getId, uint setId ) external payable { ManagerLike managerContract = ManagerLike(getMcdManager()); uint _amt = getUint(getId, amt); uint _vault = getVault(managerContract, vault); (bytes32 ilk, address u...
892,422
//SPDX-License-Identifier: MIT pragma solidity 0.8.4; import "./TransferUtils.sol"; import "./interfaces/IStakeUtils.sol"; /// @title Contract that implements staking functionality abstract contract StakeUtils is TransferUtils, IStakeUtils { string private constant ERROR_NOT_ENOUGH_FUNDS = "API3DAO.StakeUtils: ...
Convenience method to deposit and stake in a single transaction Due to the `deposit()` interface, `userAddress` can only be the caller source Token transfer source amount Amount to be deposited and staked
function depositAndStake( address source, uint256 amount ) external override { deposit(source, amount, msg.sender); stake(amount); }
6,398,367
pragma solidity ^0.5.6; import "./QuestCoinLoom.sol"; import "./QuestLootLoom.sol"; import "./Verifier.sol"; contract QuestController { // Quest Register section address owner; address ERC20contract; address ERC721contract; QuestCoinLoom qt; QuestLootLoom ql; constructor(address ERC20inp...
checking that player has made payment for this quest and hasn't won or abandoned yet
function checkAndMint( string memory questName, uint256[2] memory a, uint256[2] memory a_p, uint256[2][2] memory b, uint256[2] memory b_p, uint256[2] memory c, uint256[2] memory c_p, uint256[2] memory h, uint256[2] memory k, uint256[1] ...
12,590,247
./partial_match/1/0xd81b3000D6Cad7af85E9939AfAb1243B56618EA9/sources/VFIN.sol
move the last item into the index being vacated_totalPartitions.length -= 1;
function removeDocument(bytes32 shortName) external override { require(_isController[msg.sender], "Unauthorized"); Doc memory data = _documents[shortName]; uint256 index1 = _indexOfDocHashes[data.docHash]; bytes32 lastValue = _docHashes[_docHashes.length - 1]; _indexOfDocH...
4,032,055
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./lib/Initializable.sol"; /** * @title EdenNetworkManager * @dev Handles updates for the EdenNetwork proxy + implementation */ contract EdenNetworkManager is Initializable { /// @notice EdenNetworkManager admin address public admin; /// ...
Set new implementation for EdenNetwork proxy contract newImplementation new implementation address/ bytes4(keccak256("upgradeTo(address)")) = 0x3659cfe6
function upgrade( address newImplementation ) external onlyAdmin { (bool success, ) = edenNetworkProxy.call(abi.encodeWithSelector(hex"3659cfe6", newImplementation)); require(success, "upgrade failed"); }
256,765
pragma solidity >=0.6.0; import "./interfaces/ISmartSwapFactory.sol"; import "./lib/TransferHelper.sol"; import "./interfaces/ISmartSwapExchange.sol"; import "./lib/SmartSwapLibrary.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "./interfaces/IBEP20.sol"; import "./interfaces/IBNB.sol"; import "@ope...
SWAP requires the initial amount to have already been sent to the first Pool
function _swap( uint256[] memory amounts, address[] memory path, address _to ) internal virtual { for (uint256 i; i < path.length - 1; i++) { (address input, address output) = (path[i], path[i + 1]); (address token0, ) = SmartSwapLibrary.sortTokens(input, ...
6,417,716
pragma solidity ^0.4.21; /// @title PatientRecords /// @author Nicolas Frega - <frega.nicolas@gmail.com> /// Allows Medical Record System to maintain records of patients in their network. /// Records can be accessed by Hospitals if and only if patient provides name. /// Patients are rewarded with erc20 tokens for prov...
Allows a Hospital to view the number of records for a patient. _name Name for the patient
function getRecordByName(string _name) public hospitalExist(msg.sender) view returns (uint256 numberOfRecords) { if (mappingByName[msg.sender][_name] != 0) { numberOfRecords = mappingByName[msg.sender][_name]; return numberOfRecords; } ...
5,404,520
./partial_match/4/0x9b4aCeB68B760b035826a270ebD02DB391Ce0e65/sources/Agreement.sol
Tell whether an action can proceed to another state. An action can proceed if it is: - Not closed - Not currently challenged or disputed, and - Not already settled or had a dispute rule in favour of the challenger (the action will have been closed automatically) _action Action instance return True i...
function _canProceed(Action storage _action) internal view returns (bool) { if (_action.closed) { return false; } uint256 challengeId = _action.lastChallengeId; if (!_existChallenge(challengeId)) { return true; } ChallengeState state = chall...
8,724,952
//SPDX-License-Identifier: Unlicense pragma solidity 0.6.11; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; contract AirdropPush { using SafeERC20 for IERC20; function distribute( IERC20 token, address[] calldata accounts, ...
Returns the largest of two numbers./
function permissionedDepositors(address account) external returns (bool); function setUserSchedules(address account, uint256[] calldata userSchedulesIdxs) external; function addSchedule(StakingSchedule memory schedule) external; function getSchedules() external view returns (StakingScheduleInfo[] mem...
6,377,840
./full_match/44787/0x0aAA859ae2C87d201EfD4aE3834D9633e9b54AfA/sources/contracts/ambassadors/AmbassadorsImplementation.sol
Returns boolean whether an address is ambassador at a given entity. _ambassador Address of the ambassador _entityAddress Address of the entity return Boolean whether an address is ambassador at a given entity or not/
function isAmbassadorAt(address _ambassador, address _entityAddress) public view override returns (bool) { return ambassadorToEntity[ambassadorByAddress[_ambassador]] == entityByAddress[_entityAddress]; }
13,271,875