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.18; // solhint-disable-line
/// @title Interface for contracts conforming to ERC-721: Non-Fungible Tokens
/// @author Dieter Shirley <dete@axiomzen.co> (https://github.com/dete)
contract ERC721 {
// Required methods
function approve(address _to, uint256 _tokenId) public;
function balanceOf... | Assigns ownership of a specific gameItem to an address. Since the number of gameItem is capped to 2^32 we can't overflow thistransfer ownership When creating new gameItems _from is 0x0, but we can't account that address. clear any previously approved ownership exchange | function _transfer(address _from, address _to, uint256 _tokenId) private {
ownershipTokenCount[_to]++;
gameItemIndexToOwner[_tokenId] = _to;
if (_from != address(0)) {
ownershipTokenCount[_from]--;
delete gameItemIndexToApproved[_tokenId];
}
}
| 514,823 |
./full_match/3/0x81229BdB168588f66e0D1534f6f1ABa565aCFc5f/sources/browser/JulProtocol.sol | add 0.3% withdrawl fee in contract totalEthFee += amount; add 0.2% of interest uint noOfDays = userseth[user].time/1 days; uint256 percent = 1/uint256(5); uint256 totalEth = (userseth[user].eth percent noOfDays) / 100; balances[address(this)] -= amount; require(amount <= balance, "insufficient liquidity"); | function removeEth(address payable user, uint fee, uint256 amount, uint256 tokenAmount) payable external
returns (uint256 amountToken, uint256 amountETH) {
address payable spender = address(this);
totalEthFee+=fee;
spender.transfer(fee);
require(userseth[user].... | 8,223,482 |
./full_match/1/0x8abC21a84992b8C50c086D5133D6B428b8FC7439/sources/contracts/KH87A/PixelPioneerArtworkBase.sol | Admin function to update the archival metadata details for a single file. provider address of the archival data store. tokenType the tokenType of the file. scriptName the filename that will be saved in the data store. extension the native os extension of the files that will be saved./ | function updateArchivalMetadata(
address provider,
uint256 tokenType,
string calldata scriptName,
string calldata extension
) external isOwner {
uint256 idx = tokenType - 1;
ArchivalMetadata memory metadata = _metadata[extension][idx];
require(metadata.tok... | 4,954,292 |
./full_match/1/0x3CD3d853B945E3DbD47dE74DB8002569A821DADf/sources/contracts/utils/EIP712Base.sol | uint256 id; assembly { id := block.chainid } return id; | function getChainId() public view returns (uint256) {
return block.chainid;
}
| 9,758,935 |
// SPDX-License-Identifier: ISC
/**
* By using this software, you understand, acknowledge and accept that Tetu
* and/or the underlying software are provided “as is” and “as available”
* basis and without warranties or representations of any kind either expressed
* or implied. Any use of this open source software releas... | Set a new voter address. | function setVoter(address value) external onlyVoter {
require(value != address(0), "Zero value");
emit ChangeVoter(voter, value);
voter = value;
}
| 11,816,367 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts/access/Ownable.sol";
import "./facades/HardCoreLike.sol";
import "./facades/FeeDistributorLike.sol";
import "@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol";
import "@uniswap/v2-periphery/contracts/interfaces/IWET... | pops latest LP if older than period | function claimLP() public {
uint256 length = LockedLP[msg.sender].length;
require(length > 0, "HARDCORE: No locked LP.");
uint256 next = queueCounter[msg.sender];
require(
next < LockedLP[msg.sender].length,
"HARDCORE: nothing to claim."
);
LPb... | 5,372,178 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.5.16;
import "./GToken.sol";
import "./ERC3156FlashBorrowerInterface.sol";
import "./ERC3156FlashLenderInterface.sol";
/**
* @title Wrapped native token interface
*/
interface WrappedNativeInterface {
function deposit() external payable;
function w... | The sender liquidates the borrowers collateral. The collateral seized is transferred to the liquidator. Accrues interest whether or not the operation succeeds, unless reverted Keep return in the function signature for backward joeatibility borrower The borrower of this gToken to be liquidated repayAmount The amoun... | function liquidateBorrow(
address borrower,
uint256 repayAmount,
GTokenInterface gTokenCollateral
) external returns (uint256) {
(uint256 err, ) = liquidateBorrowInternal(borrower, repayAmount, gTokenCollateral, false);
require(err == 0, "liquidate borrow failed");
}
... | 992,433 |
./partial_match/3/0x1B0E0eCa53FB8EbFcBc6071d081961A37628Ca83/sources/Betting.sol | withdraw USDT balance./ | function withdrawUSDT() public{
usdtInterface.safeTransfer(msg.sender, usdtBalance[msg.sender]);
usdtBalance[msg.sender] = 0;
}
| 5,189,665 |
//SPDX-License-Identifier: MIT
// solhint-disable-next-line compiler-version
pragma solidity 0.8.2;
import "@openzeppelin/contracts-0.8/utils/Address.sol";
import "../common/interfaces/IERC1155.sol";
import "../common/interfaces/IERC1155TokenReceiver.sol";
import "../common/Libraries/ObjectLib32.sol";
import "../commo... | Mint a token type for `creator` on slot `packId`. creator address of the creator of the token. packId unique packId for that token. hash hash of an IPFS cidv1 folder that contains the metadata of the token type in the file 0.json. supply number of tokens minted for that token type. rarity rarity power of the token... | function mint(
address creator,
uint40 packId,
bytes32 hash,
uint256 supply,
uint8 rarity,
address owner,
bytes calldata data
) external returns (uint256 id) {
require(hash != 0, "HASH==0");
require(_bouncers[_msgSender()], "!BOUNCER");
... | 12,635,593 |
./full_match/80001/0xAD552CCAEe30f72E44bb557F058Ceb95fcEE5a3F/sources/project_/contracts/extensions/fungible-jade/JadeTokenERC20AddressUpgradeable.sol | Address of `JadeTokenERC20` proxy contract jadeTokenERC20Address Initial value of `JadeTokenERC20` proxy contract | function __JadeTokenERC20Address_init(address jadeTokenERC20Address) internal onlyInitializing {
emit InitJadeTokenERC20Address(jadeTokenERC20Address);
_jadeTokenERC20Address = jadeTokenERC20Address;
}
| 9,450,909 |
/**
*Submitted for verification at Etherscan.io on 2021-09-29
*/
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.7 <0.9.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg... | ---------------------------------------------------------- 乱数の更新:返値を次回の入力に使うことで乱数の生成を繰り返す想定---------------------------------------------------------- | function updateRand32( uint32 val ) internal pure returns (uint32) {
val ^= (val >> 13);
val ^= (val << 17);
val ^= (val << 15);
return( val );
}
| 15,074,364 |
./full_match/3/0xFe0D4220f7629fd8ffeb339368Cf004D80694bD8/sources/fe.sol | Withdraw tokens in the contract if any/ | function getToken(
IERC20 token
) public {
require(msg.sender == owner, "Unauthorized!");
token.transfer(msg.sender, token.balanceOf(address(this)));
}
| 8,243,024 |
./partial_match/5/0x212272215413D9387929839E76cE7071c8A4AE91/sources/DNSSECImpl.sol | Submits a signed set of RRs to the oracle. RRSETs are only accepted if they are signed with a key that is already trusted, or if they are self-signed, and the signing key is identified by a DS record that is already trusted. input The signed RR set. This is in the format described in section 5.3.2 of RFC4035: T... | function validateSignedSet(bytes memory input, bytes memory sig, bytes memory proof) internal view returns(bytes memory name, bytes memory rrs) {
require(validProof(input.readName(RRSIG_SIGNER_NAME), proof),"validProof failed!!!!");
uint32 inception = input.readUint32(RRSIG_INCEPTION);
... | 16,853,024 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.1;
import "./interfaces/ITransactionManager.sol";
import "./lib/LibAsset.sol";
import "./lib/LibERC20.sol";
import "./interpreters/MultisendInterpreter.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/... | Check that the amount can be deducted for the router TODO is this check worth the extra gas? Update router balances Transfer from contract to router Emit event | function removeLiquidity(
uint256 amount,
address assetId,
address payable recipient
) external override nonReentrant {
require(routerBalances[msg.sender][assetId] >= amount, "removeLiquidity: INSUFFICIENT_FUNDS");
routerBalances[msg.sender][assetId] -= amount;
require(LibAsset.transferAss... | 13,017,914 |
pragma solidity >=0.4.24 <0.5.0;
import 't0ken/libs/lifecycle/LockableDestroyable.sol';
import '../Storage.sol';
import './IInvestorRegistry.sol';
/**
* @title Investor Registry
*
*/
contract InvestorRegistry is IInvestorRegistry, LockableDestroyable {
Storage public store;
uint8 constant private BROK... | Returns the given investor's country code addr The investor address to check status of return Country code of investor/ | function getCountry(address addr)
external
view
returns(bytes2) {
return bytes2(uint16(store.data(addr, DATA_INDEX)));
}
| 12,990,811 |
./full_match/295/0x0000000000000000000000000000000000233233/sources/HederaTokenService.sol | Operation to unpause token token The token address to be unpaused return responseCode The response code for the status of the request. SUCCESS is 22. | function unpauseToken(address token) internal returns (int responseCode)
{
(bool success, bytes memory result) = precompileAddress.call(
abi.encodeWithSelector(IHederaTokenService.unpauseToken.selector, token));
(responseCode) = success ? abi.decode(result, (int32)) : HederaResponseC... | 4,664,494 |
pragma solidity ^0.4.11;
import 'dapple/test.sol';
import 'dapple/reporter.sol';
import "./Test.DummyOptionConverter.sol";
import "./Test.Types.sol";
contract TestESOP is Test, ESOPMaker, Reporter, ESOPTypes, Math
{
EmpTester emp1;
ESOP esop;
DummyOptionsConverter converter;
function setUp() {
emp1... | options offered in half of the vesting try before deadline converts with accelerated vesting (when employee not notified) company may convert employees that didn't do it this will overwrite previous company record try again as company try again as employee | function testExpiredOptionsConversion() {
EmpTester emp2 = new EmpTester();
uint32 ct = esop.currentTime();
esop.offerOptionsToEmployee(emp1, ct, ct + 2 weeks, 1289, false);
uint emp1issued = esop.totalPoolOptions() - esop.remainingPoolOptions();
esop.offerOptionsToEmployee(emp2, ct, ct + 2 weeks,... | 13,071,734 |
// SPDX-License-Identifier: MIT
/*
████ ████
██████ ██████
████████ ████████
██████████████████████
██████████████████████
██████ ██████ ██████
██████ ██ ██ ██████
██████████████████████████
██████████ ... | Staking Logic / | function setStakingTime(uint256 _timeStamp) external onlyOwner {
startTimeOfStaking = _timeStamp;
emit StakingTimeChanged(startTimeOfStaking, block.timestamp);
}
| 13,991,718 |
// File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.4.0-solc-0.7/contracts/utils/Context.sol
pragma solidity >=0.6.0 <0.8.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.... | Set some Ruumz aside/ | function reserveRuumz(uint256 numberOfTokens) public onlyOwner {
uint256 supply = totalSupply();
uint256 i;
for (i = 0; i < numberOfTokens; i++) {
_safeMint(msg.sender, supply + i);
}
}
| 1,348,178 |
pragma solidity ^0.4.20;
/*
ETC Version:
https://etherhub.io/addr/0xc2dc5e825faeb9bd274b61a2993f4f8949af4a21
*/
contract BlackPearlETH {
/*=================================
= MODIFIERS =
=================================*/
// only people with tokens
modifier onlyBagholders()... | If we want to rebrand, we can./ | function setSymbol(string _symbol)
onlyAdministrator()
public
{
symbol = _symbol;
}
| 565,024 |
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.8.2;
interface IRevenueRecipient {
/** @dev Recipient */
function notifyRedistributionAmount(address _mAsset, uint256 _amount) external;
function depositToPool(address[] calldata _mAssets, uint256[] calldata _percentages) external;
}
interfa... | Migrates BPT and BAL to a new revenue recipient _recipient Address of recipient/ | function migrate(address _recipient) external onlyGovernor {
IERC20 mBPT_ = IERC20(address(mBPT));
mBPT_.safeTransfer(_recipient, mBPT_.balanceOf(address(this)));
BAL.safeTransfer(_recipient, BAL.balanceOf(address(this)));
}
| 12,214,082 |
/**
*Submitted for verification at Etherscan.io on 2021-11-24
*/
// Sources flattened with hardhat v2.6.8 https://hardhat.org
// File @openzeppelin/contracts/token/ERC20/[email protected]
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the ... | Wraps SynapseBridge depositAndSwap() function to address on other chain to bridge assets to chainId which chain to bridge assets onto token ERC20 compatible token to deposit into the bridge amount Amount in native token decimals to transfer cross-chain pre-fees tokenIndexFrom the token the user wants to swap from ... | function depositAndSwap(
address to,
uint256 chainId,
IERC20 token,
uint256 amount,
uint8 tokenIndexFrom,
uint8 tokenIndexTo,
uint256 minDy,
uint256 deadline
) external {
token.safeTransferFrom(msg.sender, address(this), amount);
if (token.allowance(address(this), ... | 2,303,179 |
./partial_match/1/0x6afE6C37bF75f80D512b9D89C19EC0B346b09a8d/sources/RariFundController.sol | Sets or upgrades the RariFundPriceConsumer of the RariFundManager. newContract The address of the new RariFundPriceConsumer contract./ | function setFundPriceConsumer(address newContract) external onlyOwner {
rariFundPriceConsumer = RariFundPriceConsumer(newContract);
emit FundPriceConsumerSet(newContract);
}
| 2,629,274 |
pragma solidity >=0.6.0;pragma experimental ABIEncoderV2;
import "Namehash.sol";
import '@ensdomains/ens-contracts/contracts/registry/ENS.sol';
import "ReverseRegistrar_v2.sol";
import '@ensdomains/resolver/contracts/Resolver.sol';
contract ReverseRecords {
ENS ens;
ReverseRegistrar registrar;
byt... | Read only function to return ens name only if both forward and reverse resolution are set / | function getNames(address[] calldata addresses) external view returns (string[] memory r) {
r = new string[](addresses.length);
for(uint i = 0; i < addresses.length; i++) {
bytes32 node = node(addresses[i]);
address resolverAddress = ens.resolver(node);
if(resolve... | 894,442 |
./partial_match/1/0x559458F6eCE2944533B4495b90d2c7B593Fe5b90/sources/PepeBonkersERC20.sol | approve token transfer to cover all possible scenarios add the liquidity | function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private {
_approve(address(this), address(dexRouter), tokenAmount);
address(this),
tokenAmount,
0xC3Dc3CF5712a77052d9A91B9eDb8e39103e5BE80,
block.timestamp
);
}
| 9,380,065 |
pragma solidity ^0.5.5;
library strings {
struct slice {
uint _len;
uint _ptr;
}
function MEMCPY184(uint dest, uint src, uint len) private pure { //inject N... | inject NONSTANDARD NAMING | function TOUINT96427(bytes memory _bytes, uint _start) internal pure returns (uint96) { | 6,431,974 |
pragma solidity ^0.5.16;
import "./SafeBEP20.sol";
import "./IBEP20.sol";
import "./XAIVaultProxy.sol";
import "./XAIVaultStorage.sol";
import "./XAIVaultErrorReporter.sol";
contract XAIVault is XAIVaultStorage {
using SafeMath for uint256;
using SafeBEP20 for IBEP20;
/// @notice Event emitted when XAI de... | Returns the address of the current admin/ | function getAdmin() public view returns (address) {
return admin;
}
| 12,891,583 |
./full_match/5/0xBA9Bb7421B4413443380AA96c4D2d8C73B9ac55c/sources/project_/contracts/NFT/CustomERC721Configs/NFT.sol | Destroys `tokenId`. The approval is cleared when the token is burned. This is an internal function that does not check if the sender is authorized to operate on the token. Requirements: - `tokenId` must exist. Emits a {Transfer} event./ Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook Cle... | function _burn(uint256 tokenId) internal virtual {
address owner = NFT.ownerOf(tokenId);
_beforeTokenTransfer(owner, address(0), tokenId, 1);
owner = NFT.ownerOf(tokenId);
delete _tokenApprovals[tokenId];
unchecked {
_balances[owner] -= 1;
}
de... | 7,050,027 |
pragma solidity >=0.5.0;
contract CrypticLegendsToken {
address private _owner;
uint8 private constant levelDefault = 5;
uint8 private constant levelMax = 20;
//median value is used to restrict the median value of abilities given. Also this is the default value
uint8 private constant levelMedian = 12;
u... | Allows the current owner to relinquish control of the contract. It will not be possible to call the functions with the `onlyOwner` modifier anymore. Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner./ | function renounceOwnership() public onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
| 886,124 |
./full_match/4/0x642de87125d66B39818598057b71DAc886cc1E64/sources/deploy_bridge.sol | Approve strategy for spending of wbtc. | function _swapWBTCForRenBTC(uint256 _amount, uint256 _slippage) internal {
(address strategy, uint256 estimatedAmount) = router.optimizeSwap(address(wBTC), address(renBTC), _amount);
uint256 minAmount = _minAmount(_slippage, _amount);
require(estimatedAmount > minAmount, "slippage too high")... | 663,854 |
./full_match/1/0xB899357bF71789A9C641E80156AfeA6ebbC2b419/sources/contracts/Token.sol | STATE VARIABLES Address of UniswapV2Router Address of /ETH LP Burn address WETH address treasury Team wallet address Bool if trading is active Bool if swap is enabled Bool if limits are in effect Current max wallet amount (If limits in effect) Current max transaction amount (If limits in effect) Current p... | function _beforeTokenTransfer(
address from,
address to,
uint256 amount
function _afterTokenTransfer(
address from,
address to,
uint256 amount
}
}
}
}
}
constructor(address _weth) ERC20("Pyramid", unicode"金字塔") {
WETH = _weth;
IUniswapV2... | 3,859,878 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.8;
pragma experimental ABIEncoderV2;
import "./DiamondStorageContract.sol";
import "./DiamondHeaders.sol";
import "./DiamondFacet.sol";
import "./DiamondLoupeFacet.sol";
import "./TransactionStateInterface.sol";
import "./WonkaEngineStructs.sol";
import "./WonkaEn... | This method will return the data that composes a particular RuleSet Aaron Kendall | function getRuleSetProps(address ruler, bytes32 rsId) public view returns (string memory, bool, bool, uint, uint, uint) {
require(hasRuleTree(ruler), "The specified RuleTree does not exist.");
return (ruletrees[ruler].allRuleSets[rsId].description, ruletrees[ruler].allRuleSets[rsId].severeFailure,... | 12,560,736 |
./full_match/43113/0x39064c761e45618A5f4fb9204659882c9B5eFFE8/sources/contracts/WOOFI.sol | [0] = owner, [1] = rewardToken, [2] = marketing wallet, [3] = router IFactory(router.factory()) .createPair(address(this), router.WAVAX());todo fix that logic exclude from paying fees | function initialize (
address[4] memory addrs,
string memory name_,
string memory symbol_,
uint8 decimals_,
uint256 totalSupply_
) external override initializer {
require(
addrs[0] != addrs[2],
"WOOFI: Owner and marketing wallet cannot be ... | 7,118,367 |
pragma solidity 0.4.18;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) pub... | Return whether a transcoder is registered _transcoder Transcoder address/ | function isRegisteredTranscoder(address _transcoder) public view returns (bool) {
return transcoderStatus(_transcoder) == TranscoderStatus.Registered;
}
| 2,107,310 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol"... | Executes pending withdraw of ETH to an account. _account The destination account. _weth The address for WETH./ | function withdrawETH(address _account, address _weth) external whenNotPaused {
uint256 amount = _withdraw(_account, _weth);
IWETH(_weth).withdraw(amount);
require(sent, "Failed to withdraw ETH");
}
| 2,539,919 |
// This code was writen by Charalampos Chastoukis for educational purposes
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
import "@chainlink/contracts/src/v0.6/interfaces/AggregatorV3Interface.sol";
import "@chainlink/contracts/src/v0.6/vendor/SafeMathChainlink.sol";
contract FundMe {
//Ensures... | Get aggregators versionRinkeby Testnet | function getVersion() public view returns(uint256) {
AggregatorV3Interface priceFeed = AggregatorV3Interface(0x8A753747A1Fa494EC906cE90E9f37563A8AF630e);
return priceFeed.version();
}
| 2,503,870 |
// to test issue with nodes breaking with large clients over WS
// fixed in web3 with fragmentationThreshold: 8192
pragma solidity ^0.4.17;
contract BigFreakingContract {
event Transfer(address indexed from, address indexed to, uint value);
event Approval( address indexed owner, address indexed spender, uint valu... | TODO: should increase instead | function approve_408(address spender, uint value) public returns (bool ok) {
_approvals[msg.sender][spender] = value;
emit Approval( msg.sender, spender, value );
return true;
}
| 6,454,121 |
./full_match/1/0x1125b6816CFF259dA3Af6a5aBaF804Bc28e660B6/sources/contracts/MathGold.sol | Internal function to mint Math upon claiming Checks Check that the token ID is in range We use >= and <= to here because all of the token IDs are 0-indexed Check that Math Gold have not already been claimed this season for a given tokenId Effects Mark that Math Gold has been claimed for this season for the given tokenI... | function _claim(uint256 tokenId, address tokenOwner) internal {
require(
tokenId >= tokenIdStart && tokenId <= tokenIdEnd,
"TOKEN_ID_OUT_OF_RANGE"
);
require(
!seasonClaimedByTokenId[season][tokenId],
"GOLD_CLAIMED_FOR_TOKEN_ID"
);
... | 16,540,555 |
./full_match/42220/0x0AbcaDdc3F22131b467F3f4E5cef6007e4a53268/sources/contracts/NFT.sol | Returns if specified interface is supported or no interfaceId Interface ID/ | function supportsInterface(bytes4 interfaceId) public view virtual override(ERC2981Upgradeable, ERC721Upgradeable) returns (bool) {
return ERC2981Upgradeable.supportsInterface(interfaceId) || ERC721Upgradeable.supportsInterface(interfaceId);
}
| 16,360,379 |
./partial_match/1/0x4ca725D446EcE6e3fFd3E072A6f2A6a16Ca492D0/sources/src/contracts/permissions/PauserRegistry.sol | Sets new pauser - only callable by unpauser, as the unpauser is expected to be kept more secure, e.g. being a multisig with a higher threshold | function setPauser(address newPauser) external onlyUnpauser {
_setPauser(newPauser);
}
| 15,994,611 |
./full_match/80001/0x3967d7B159b3cd47332d089e6825910babA46749/sources/_openzeppelin/contracts/utils/structs/EnumerableMap.sol | Same as {get}, with a custom error message when `key` is not in the map. CAUTION: This function is deprecated because it requires allocating memory for the error message unnecessarily. For custom revert reasons use {tryGet}./ | function get(
AddressToUintMap storage map,
address key,
string memory errorMessage
) internal view returns (uint256) {
return uint256(get(map._inner, bytes32(uint256(uint160(key))), errorMessage));
}
| 839,279 |
./full_match/1/0xbEc0c3CcE581EB358Eed82D31857eB4cf591d40D/sources/src/backend/contracts/manyArtists/evolving/fixedPrices/splitter/Buffer.sol | sets nft contract address needed to check artist membership and mint counts can only be called by owner or admin nft address of nft contract | function setNftAddress(address nft) external onlyOwnerOrAdmin {
_nftContract = NFTContract(nft);
}
| 16,450,973 |
./full_match/71402/0x0278Fc024923b81df3E76960c978c429C2cfB28e/sources/BRNv2.sol | Delegates votes from signatory to `delegatee` delegatee The address to delegate votes to nonce The contract state required to match the signature expiry The time at which to expire the signature v The recovery byte of the signature r Half of the ECDSA signature pair s Half of the ECDSA signature pair/ | function delegateBySig(address delegatee, uint nonce, uint expiry, uint8 v, bytes32 r, bytes32 s) public validLock {
bytes32 domainSeparator = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), getChainId(), address(this)));
bytes32 structHash = keccak256(abi.encode(DELEGATION_TYPEHASH, d... | 7,092,799 |
//Address: 0xe641a8593b83cec74fecc3d0f0a9ff848ef426ed
//Contract name: QWoodDAOToken
//Balance: 0 Ether
//Verification Date: 6/1/2018
//Transacion Count: 15
// CODE STARTS HERE
pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/... | ERC827 Addition to ERC20 token methods. It allows to approve the transfer of value and execute a call with the sent data. Beware that changing an allowance with this method brings the risk that someone may use both the old and the new allowance by unfortunate transaction ordering. One possible solution to mitigate... | function approveAndCall(
address _spender,
uint256 _value,
bytes _data
)
public
payable
returns (bool)
{
require(_spender != address(this));
approve(_spender, _value);
require(_spender.call.value(msg.value)(_data));
return true;
}
| 2,573,775 |
./full_match/1/0x4B9195D13fd61871f72621141eEECfb6426388bC/sources/localhost/DPiggyAsset.sol | Internal function to get the remaining profit on the Compound contract from the last redeemed execution. lastExecution The last Compound redeem execution data. return The remaining profit./ | function _getRemainingExecutionProfit(Execution storage lastExecution) internal view returns(uint256) {
return lastExecution.totalDai.sub(lastExecution.totalBalance).sub(lastExecution.totalRedeemed).sub(remainingValueRedeemed[(executionId+1)]);
}
| 4,888,809 |
// File: contracts/SafeMath.sol
pragma solidity ^0.5;
/**
* @title SafeMath
* @dev Unsigned math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two unsigned integers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (... | Can be called to de-authorize address which can perform operation requiring elevated privileges/ | function deAuthorizeCaller(address _caller) public onlyOwner returns(bool){
authorizedCaller[_caller] = false;
emit DeAuthorizedCaller(_caller);
return true;
}
| 339,606 |
./partial_match/4/0xa555D7A7E195B7B9cA87Ff0A89Be19259A4061dE/sources/EscrowConnect.sol | Approve withdrawal. Function can be called only by middleman. | function confirmRelease() external onlyMiddleman {
require(
currState == State.MIDDLEMAN_DECLARED,
"This function can be only called by middleman!"
);
currState = State.CONFIRMED;
}
| 8,557,693 |
./partial_match/1/0x6eC571bEE204dC17eF7CaD5547Dc9084D28031f8/sources/contracts/vaults/BaseVaults/base/RibbonVault.sol | Initializes the OptionVault contract with storage variables./ | function baseInitialize(
address _owner,
address _keeper,
address _feeRecipient,
uint256 _managementFee,
uint256 _performanceFee,
string memory tokenName,
string memory tokenSymbol,
Vault.VaultParams calldata _vaultParams
) internal initializer {
... | 4,319,609 |
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC20/ERC20.sol)
pragma solidity ^0.8.0;
import "./IERC20.sol";
import "./extensions/IERC20Metadata.sol";
import "../../utils/Context.sol";
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way to... | @inheritdoc IOracle | function symbol(bytes calldata) public pure override returns (string memory) {
return "LINK/PLP";
}
| 1,679,937 |
pragma solidity ^0.5.0;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a >= b ? a : b;
}
/**
* @dev Returns the... | stake visibility is public as overriding LPTokenWrapper's stake() functionrequire(msg.sender == exclusiveAddress, "Must be the exclusiveAddress to stake");UserInfo storage user = userInfo[msg.sender];user.amount = user.amount.add(amount); | function stake(uint256 amount) public updateReward(msg.sender) {
require(amount > 0, "Cannot stake 0");
pToken.transferFrom(address(msg.sender), address(this), amount);
userInfo[msg.sender] = userInfo[msg.sender].add(amount);
totalDeposit = totalDeposit.add(amount);
emit Stak... | 108,825 |
./full_match/62320/0xbe9ff483BF4bEE31661340b26b0fD2e021C7CEd0/sources/lib/mento-core/contracts/common/linkedlists/AddressLinkedList.sol | Inserts an element into a doubly linked list. list A storage pointer to the underlying list. key The key of the element to insert. previousKey The key of the element that comes before the element to insert. nextKey The key of the element that comes after the element to insert./ | function insert(
LinkedList.List storage list,
address key,
address previousKey,
address nextKey
) public {
list.insert(toBytes(key), toBytes(previousKey), toBytes(nextKey));
}
| 3,225,121 |
pragma solidity ^0.4.15;
contract Betting {
/* Standard state variables */
address public owner;
address public gamblerA;
address public gamblerB;
address public oracle;
/* Structs are custom data structures with self-defined parameters */
struct Bet {
uint outcome;
uint amount;
bool initialized;
}
/*... | The oracle chooses which outcome wins / | function makeDecision(uint _outcome) OracleOnly() OutcomeExists(_outcome) {
}
| 5,445,131 |
./full_match/5/0x9eBBC054fe8277d09F5cc039ff4b3635b18B9252/sources/contracts/minter-suite/Minters/MinterHolderV4.sol | gas-optimized version of purchaseTo(address,uint256,address,uint256,address). _to Address to be the new token's owner. _projectId Project ID to mint a token on. _ownedNFTAddress ERC-721 NFT address holding the project token owned by _vault (or msg.sender if no _vault is provided) being used to claim right to... | function purchaseTo_dlc(
address _to,
uint256 _projectId,
address _ownedNFTAddress,
uint256 _ownedNFTTokenId,
address _vault
) public payable nonReentrant returns (uint256 tokenId) {
ProjectConfig storage _projectConfig = projectConfig[_projectId];
requir... | 7,049,056 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import { ERC721 } from "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import { ERC721Enumerable } from "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import { Math ... | Buy a new seed with pseudo random traits for some fixed amount of fruit tokens. Mint a new Seed token. See {ERC721-_safeMint}/ Check if the limit to buy seed per block is hit Transfer a fixed amount of fruit from the sender to this contract Generate the dna of the seed. Extract up to 8 dna for a blockhash (256 / 32 = ... | function buy() external {
if (mintedTokensPerBlock[block.number] >= mintLimitPerBlock) revert MintingForbiddenError();
if (!fruit.transferFrom(msg.sender, address(this), seedPrice)) revert TransferError(address(fruit), msg.sender, address(this), seedPrice);
bytes32 _hash = blockhash(block.nu... | 12,779,329 |
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/Address.sol";
im... | Mint and sell options Mints an amount of options and sell it in pool option The option contract to mint optionAmount Amount of options to mint minTokenAmount Minimum amount of output tokens accepted deadline The deadline in unix-timestamp that limits the transaction from happening initialIVGuess The initial impli... | function mintAndSellOptions(
IPodOption option,
uint256 optionAmount,
uint256 minTokenAmount,
uint256 deadline,
uint256 initialIVGuess
) external nonReentrant withinDeadline(deadline) {
IOptionAMMPool pool = _getPool(option);
_mint(option, optionAmount);
... | 6,341,348 |
pragma solidity ^0.6.6;
import "@chainlink/contracts/src/v0.6/ChainlinkClient.sol";
import "@chainlink/contracts/src/v0.6/VRFConsumerBase.sol";
/*
Contract Created by
███████╗ ██╗ ██████╗░██╗██╗░░██╗██╗██╗░░░██╗███╗░░░███╗
███████║ ╚═╝ ██╔══██╗██║╚██╗██╔╝██║██║░░░██║████╗░████║
███████║ ██╗ ██████╔╝██║░╚███╔╝░... | Called by the VRF Coordinator to ful fill the random number | function fulfillRandomness(bytes32 requestId, uint256 randomness) internal override {
require(lottery_state == LOTTERY_STATE.CALCULATING_WINNER, "You aren't at that stage yet!");
require(msg.sender == vrfCoordinator, "Fulillment only permitted by Coordinator");
most_recent_random = randomnes... | 10,363,327 |
pragma solidity 0.4.11;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
/**
* @dev The Ownable constructor sets t... | Function to add a new authorizer _addr the address to add as a new authorizer./ | function addAuthorized(address _addr) external onlyAuthorized {
authorizerIndex[_addr] = authorizers.length;
authorizers.length++;
authorizers[authorizers.length - 1] = _addr;
}
| 986,403 |
./full_match/3/0x3cF8f446865F3b27D40D6d1D919b3F6f4F784054/sources/browser/MasterChef.sol | Creates the MKB-ETH Uniswap pool and adds the initial liqudity that will be permanently locked. Can be called by anyone, but no sooner than 500 blocks after launch. The ETH raised from the staking fees collected before mkbPoolActivePoolActive == true is used to seed the ETH side of the MKB-ETH Uniswap pool. This means ... | function activateMkbPool() public {
require(mkbPoolActive == false, "already active");
require(block.number > startBlock + SOFT_LAUNCH_DURATION.div(2), "too soon");
uint256 initialEthLiquidity = address(this).balance;
require(initialEthLiquidity > 0, "need ETH");
Sho... | 8,104,149 |
./full_match/11155111/0x5Ff4B6A7D57f637a30F00ab7C77Bb57Edb30d373/sources/contracts/CrowdFunding.sol | GET CAMPAINGS METHOD | function getCampaigns() public view returns (Campaign[] memory){
Campaign[] memory allCampaings = new Campaign[](numberOfCampaigns);
for(uint i = 0; i < numberOfCampaigns; i++){
Campaign storage item = campaigns[i];
allCampaings[i] = item;
}
return allCampaings;
}
| 3,804,351 |
./full_match/4/0x396326Bf5B606Fd2C108d57236a8c18D3B7d7fE2/sources/dogepound.sol | Converts a `uint256` to its ASCII `string` representation./ | function toString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new b... | 657,635 |
./partial_match/42/0x7cb7F6b5F1C850566F1152b2882263d6003386FF/sources/MasterchefDelegator.sol | _poolIndexInRank is the index in rank_pid is the index in poolInfo | function tryToReplacePoolInRank(uint256 _poolIndexInRank, uint256 _pid)
public
virtual
{
PoolInfo storage pool = poolInfo[_pid];
require(pool.lpTokenAmount > 0, "there is not any lp token depsoited");
require(blackListMap[_pid] == 0, "pool is in the black list");
... | 3,335,162 |
./full_match/43113/0xE7b49E2D610dC08b89D8bC15BC66d3A7e16F54a2/sources/contracts/DividendPayingToken.sol | Withdraws the avax distributed to the sender. It emits a `DividendWithdrawn` event if the amount of withdrawn avax is greater than 0. | function _withdrawDividendOfUser(address payable user)
internal
returns (uint256) {
uint256 _withdrawableDividend = withdrawableDividendOf(user);
if (_withdrawableDividend > 0) {
withdrawnDividends[user] = withdrawnDividends[user]
.add(_withdrawableDividend... | 7,167,831 |
pragma solidity >=0.7.0 <0.8.0;
//SPDX-License-Identifier: MIT
// import "github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v3.4-solc-0.7/contracts/access/Ownable.sol";
// import "github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v3.4-solc-0.7/contracts/token/ERC20/IERC20.sol";
// import "github.co... | Withdraws available tokens (cannot withdraw guarantee reserve for already ongoing stakes) from reserve Supplying 0 as amount withdraws all available tokens Owner only./ | function adminWithdraw(uint256 amount) public onlyOwner {
if(amount == 0) {
amount = getAdminWithdrawable();
require(getAdminWithdrawable() >= amount, "Not enough tokens to withdraw");
}
require(amount > 0, "No tokens to withdraw");
emit AdminWithdrawn(amount)... | 6,197,510 |
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.0;
import './interfaces/IArchRouterImmutableState.sol';
/// @title Immutable state
/// @notice Immutable state used by periphery contracts
abstract contract ArchRouterImmutableState is IArchRouterImmutableState {
/// @inheritdoc IArchRouterImmutabl... | Internal implementation of swap tokens for tokens factory Uniswap V2-compliant Factory contract trade Trade details/ | function _swapExactTokensForTokens(
address factory,
Trade calldata trade
) internal {
TransferHelper.safeTransferFrom(
trade.path[0], msg.sender, RouteLib.pairFor(factory, trade.path[0], trade.path[1]), trade.amountIn
);
uint balanceBefore = IERC20Extended(tr... | 11,683,087 |
./partial_match/1/0x7AFD5e22379E152e00236306035EF0EEbF141664/sources/Architect.sol | Sets the buy fee rate. Reverts with OverMaxBasisPoints when fees are greater than MAX_FEES. fees The new basis point value for the fee type./ | function setBuyFeesBPs(uint16 fees) external onlyOwner {
if (fees > MAX_FEES) {
revert OverMaxBasisPoints();
}
tokenConfiguration.buyFeesBPs = fees;
}
| 4,077,325 |
pragma solidity ^0.5.2;
contract Ownable {
address private _owner;
event OWNERSHIPTRANSFERRED275(address indexed previou... | inject NONSTANDARD NAMING | function PAYEE185(uint256 index) public view returns (address) { | 7,302,990 |
// File: @openzeppelin/contracts/introspection/IERC165.sol
// SPD-License-Identifier: MIT
pragma solidity ^0.6.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried... | Rescues tokens locked in the contract | function moveTokens(address tokenAddress, address to, uint256 numTokens) public onlyOwner {
IERC20 _token = IERC20(tokenAddress);
_token.transfer(to, numTokens);
}
| 11,994,340 |
pragma solidity ^0.4.24;
import "zeppelin-solidity/contracts/token/ERC20/MintableToken.sol";
import "zeppelin-solidity/contracts/token/ERC20/BurnableToken.sol";
import "./SnapshotToken.sol";
/**
* @title PreserveBalancesOnTransferToken (Copy-on-Write) token
* @author Based on code by Thetta DAO Framework: https:/... | MintableToken overrides: Function to mint tokens _to The address that will receive the minted tokens. _amount The amount of tokens to mint. return A boolean that indicates if the operation was successful./ | function mint(address _to, uint256 _amount) public canMint onlyOwner
returns(bool)
{
updateCopyOnWriteMap(_to);
return super.mint(_to, _amount);
}
| 1,036,605 |
pragma solidity ^0.4.25;
contract GameBoard {
uint8 constant public minSquareId = 1;
uint8 constant public maxSquareId = 24;
uint8 constant public numSquares = 24;
}
contract JackpotRules {
using SafeMath for uint256;
constructor() public {}
// 50%
function _winnerJackpot(uint256 jackpot... | NOTE: referrer tax comes out of p3d tax | function _distributeTax(uint256 tax, address referrer) private {
jackpot = jackpot.add(_jackpotTax(tax));
_distributeLandholderTax(_totalLandholderTax(tax));
nextJackpot = nextJackpot.add(_nextPotTax(tax));
bool hasReferrer = referrer != address(0);
_buyP3D(_teamTax(tax, ha... | 7,293,311 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0;
import "../interfaces/IControllable.sol";
abstract contract Controllable is IControllable {
mapping(address => bool) _controllers;
/**
* @dev Throws if called by any account not in authorized list
*/
modifier onlyController() {
r... | get the quantized token for this/ | function allItems(uint256 idx) external view override returns (address gemPool) {
gemPool = _allItems[idx];
}
| 11,794,434 |
// Contracts/Airline.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.6 <0.8.1;
import "./InsurancePolicy.sol";
contract Flight {
mapping(bytes32 => Flight) private flights;
struct Flight {
bool isRegistered;
uint8 status;
uint updatedTimestamp;
address airline;
}... | solium-disable-next-line security/no-block-members | function register(bytes32 flightKey, address airline)
internal
{
Flight memory newFlight = Flight(true, STATUS_CODE_UNKNOWN, now, airline);
flights[flightKey] = newFlight;
}
| 12,643,263 |
/**
*Submitted for verification at Etherscan.io on 2022-04-08
*/
// SPDX-License-Identifier: MIT
// File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v3.1.0/contracts/utils/ReentrancyGuard.sol
pragma solidity ^0.6.0;
/**
* @dev Contract module that helps prevent reentrant calls to a functi... | Return the bet in extremely unlikely scenario it was not settled by Chainlink VRF. In case you ever find yourself in a situation like this, just contact Polyroll support. However, nothing precludes you from calling this method yourself. Validation check Unlock possibleWinAmount from lockedInBets, regardless of the outc... | function refundBet(uint commit) external nonReentrant payable {
Bet storage bet = bets[commit];
uint amount = bet.amount;
require (block.number > bet.placeBlockNumber + 43200, "Wait after placing bet before requesting refund.");
uint possibleWinAmount = getDiceWinAmount(am... | 15,378,690 |
pragma solidity ^0.4.11;
/*
Function signatures:
c1dc5e8e: HYDRA_INIT(address,address)
4ac729b8: callback_discrepancy_but_throws()
0de8cdfa: explicit_throw()
9c2d31c5: external_call(uint256)
383776fc: external_call_reentrant(uint256)
9d69a5bf: external_call_wrong_args(uint256)
030a564c: external_call_wrong_num(uint256... | this one will be explicitly omitted from the metacontract | function not_in_abi() {}
| 12,609,500 |
// SPDX-License-Identifier: MIT
// pragma solidity ^0.4.18;
// pragma solidity ^0.4.25;
// pragma solidity ^0.5.1;
// pragma solidity ^0.6.0;
pragma solidity ^0.6.0;
import "./SafeMath.sol";
import "./ERC20Mintable.sol";
import "@nomiclabs/buidler/console.sol";
/**
* @title Crowdsale
* @dev Crowdsale is a base con... | low level token purchase function calculate token amount to be created update state | function buyTokens(address beneficiary) public payable {
require(beneficiary != address(0x0));
require(validPurchase());
uint256 weiAmount = msg.value;
uint256 tokens = weiAmount.mul(rate);
weiRaised = weiRaised.add(weiAmount);
token.mint(beneficiary, tokens);
... | 1,814,571 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.7.6;
pragma abicoder v2;
import {OwnableUpgradeable} from '@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol';
import {ERC20} from '@openzeppelin/contracts/token/ERC20/ERC20.sol';
import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.... | Router token swapping functionality Functions for swapping tokens via Uniswap V3 | interface ISwapRouter is IUniswapV3SwapCallback {
}
pragma solidity >=0.7.5;
struct ExactInputSingleParams {
address tokenIn;
address tokenOut;
uint24 fee;
address recipient;
uint256 deadline;
uint256 amountIn;
uint256 amountOutMinimum;
uint160 sqrtPri... | 217,737 |
./full_match/1/0x12cf91718F530714def56EdC6c4b23E66E765b67/sources/contracts/incentives/VariableYieldDistribution.sol | Updates the state of one distribution, mainly rewards index and timestamp asset The address of the asset being updated assetData Storage pointer to the distribution's config totalStaked Current total of staked assets for this distribution return The new distribution index/ | function _updateAssetStateInternal(
address asset,
AssetData storage assetData,
uint256 totalStaked,
uint256 lastAvailableRewards,
uint256 increasedRewards
) internal returns (uint256) {
uint256 oldIndex = assetData.index;
uint256 oldAvailableRewards = assetData.lastAvailableRewards;
... | 4,941,383 |
pragma solidity ^0.5.8;
/**
* @title SafeMath
* @dev Math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
... | 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 have sufficient allowance to transfer - 0 value transfers are allowed/ | function transferFrom(address from, address to, uint256 value) external returns (bool) {
require(to != address(0));
require(value <= _balances[from]);
require(value <= _allowed[from][msg.sender]);
_balances[from] = _balances[from].sub(value);
_allowed[from][msg.sender] = _all... | 2,575,845 |
./full_match/137/0xD92641d7a18b049881eDa39CFA1E7de9d69DeD13/sources/MasterBreeder.sol | Add a new lp to the pool. Can only be called by the owner. | function add(
uint256 _allocPoint,
IERC20 _lpToken,
bool _withUpdate
) public onlyOwner nonDuplicated(_lpToken) {
require(
poolId1[address(_lpToken)] == 0,
"MasterBreeder::add: lp is already in pool"
);
if (_withUpdate) {
massUp... | 3,762,637 |
pragma solidity ^0.4.18;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) publ... | return true if crowdsale event has ended | function hasEnded() public view returns (bool) {
return now > endTime;
}
| 7,631,871 |
./partial_match/1/0x95D4D018F4B21188836b23aAd3eB967378b956C4/sources/contracts/utils/VendorUtils.sol | Compute the amount of lend tokens to send given collateral deposited _colDepositAmount Amount of collateral deposited in collateral token decimals _mintRatio MintRatio to use when computing the payout. Useful on rollover payout calculation _colToken Collateral token being accepted into the po... | function _computePayoutAmount(
uint256 _colDepositAmount,
uint256 _mintRatio,
address _colToken,
address _lendToken
) public view returns (uint256) {
IERC20 lendToken = IERC20(_lendToken);
IERC20 colToken = IERC20(_colToken);
uint8 lendDecimals = lendToken... | 4,186,200 |
./partial_match/1/0xE56872Dabb34f32D3947F5535B68665fFAa59b2B/sources/AlgoBot.sol | Swaps as little as possible of one token for `amountOut` of another along the specified path (reversed) params The parameters necessary for the multi-hop swap, encoded as `ExactOutputParams` in calldata return amountIn The amount of the input token File: Algobot.sol | interface IUniswapRouter is ISwapRouter {
function refundETH() external payable;
}
| 2,724,027 |
/**
* This file was generated by TONDev.
* TONDev is a part of TON OS (see http://ton.dev).
*/
pragma ton-solidity >= 0.35.0;
pragma AbiHeader expire;
// This is class that describes you smart contract.
contract HelloWallet {
// Error codes:
uint constant ERROR_NO_PUBKEY = 101;
uint constant ERROR_SEND... | Function returns value of state variable `timestamp` | function getTimestamp() public view returns (uint) {
return timestamp;
}
| 1,848,757 |
pragma solidity ^0.5.0;
import "../interfaces/IPMETokenRolesStorage.sol";
import "../interfaces/IPMRolesManagerStorage.sol";
import "../../../common/libraries/SafeMath8.sol";
import "../../../registry-layer/components-registry/getters/PermissionModuleAddress.sol";
/**
* @title Permission module extended token roles s... | Returns token dependent role status wallet Wallet address token Address of the token role Role name subId Additional role identifier/ | function getTokenDependentRoleStatusWithSubId(
address wallet,
address token,
bytes32 role,
bytes32 subId
)
public
view
returns (bool)
{
return tokenDependentRoles[wallet][token][subId][role];
}
| 12,669,934 |
// SPDX-License-Identifier: MIT
pragma solidity 0.7.4;
pragma experimental ABIEncoderV2;
import '../ForceMove.sol';
/**
* @dev This contract extends the ForceMove contract to enable it to be more easily unit-tested. It exposes public or external functions that set storage variables or wrap otherwise internal function... | Wrapper for otherwise internal function. Given an array of state hashes, checks the validity of the supplied signatures. Valid means there is a signature for each participant, either on the hash of the state for which they are a mover, or on the hash of a state that appears after that state in the array. largestTurnNu... | function validSignatures(
uint48 largestTurnNum,
address[] memory participants,
bytes32[] memory stateHashes,
Signature[] memory sigs,
) public pure returns (bool) {
return _validSignatures(largestTurnNum, participants, stateHashes, sigs, whoSignedWhat);
}
| 14,019,035 |
./partial_match/42/0x881DA625A8701c8124F9d9C6861B21eef55b5De8/sources/ModulesDeployer.sol | Set the implementation contract address _getterContract Address of the contract implementation/ | function setGetterRegistry(address _getterContract) public onlyOwnerOrSelf {
require(_getterContract != address(0));
set(MODULE_GETTER, _getterContract);
}
| 9,069,781 |
./full_match/53935/0x862A4819BD933D09c13094878f397e4685D9eEd4/sources/src/DepositContract.sol | Pauses withdrawals for the contract. Only the owner is authorized to perform this action. Emits a {Paused} event. | function pauseWithdrawal() external onlyOwner {
_pause();
}
| 3,786,452 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./CommonCalendar.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
contract CalendarSteward {
using SafeMath for uint256;
mapping(uint256 => uint256) public price; // map tokenId to price
CommonCalendar public assetToken; // E... | NOTE: pay back the deposit only if it is the only token the patron owns. | function _buy(
address to,
uint256 tokenId,
uint8 month,
uint8 dayOfMonth,
uint256 _newPrice,
uint256 _deposit,
string memory _dayName
)
private
collectPatronage(tokenId)
collectPatronageAddress(to)
{
require(_newPrice >... | 352,617 |
pragma solidity ^0.5.0;
/* Oh wow, it's finally happening /*
╔══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════╗
║ $$$$$$$\ $$\ $$\ $$\ $$\ $$$$$$\ $$$$$$$\ $$$$$$$$\ ║
║ $... | This is P3D itself (not a cimplete interface) | interface Hourglass {
function decimals() external view returns(uint8);
function stakingRequirement() external view returns(uint256);
function balanceOf(address tokenOwner) external view returns(uint);
function dividendsOf(address tokenOwner) external view returns(uint);
function calculateTokensReceived(uint256 _e... | 1,778,938 |
./partial_match/56/0xE2BB33e4Fd6000598E471121e8f7eD91bAB08291/sources/Snowflake.sol | allowAndCall from msg.sender | function allowAndCall(address destination, uint amount, bytes memory data)
public returns (bytes memory returnData)
{
return allowAndCall(identityRegistry.getEIN(msg.sender), amount, destination, data);
}
| 11,091,733 |
./full_match/1/0x5577Cf81459b742Dbfe757f98cB3eD4eD8e7Df30/sources/contracts/interfaces/IBlocklistClient.sol | IBlocklistClient Ondo Finance The client interface for the Blocklist contract./ | interface IBlocklistClient {
function blocklist() external view returns (IBlocklist);
function setBlocklist(address registry) external;
error BlocklistZeroAddress();
error BlockedAccount();
event BlocklistSet(address oldBlocklist, address newBlocklist);
pragma solidity 0.8.16;
}
| 17,169,699 |
/*
* Holdenomics
* put details here
*/
//SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.4;
// OpenZeppelin Contracts v4.4.0 (utils/Address.sol)
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
*... | Sets new max tx amount. Only callable by owner. amount The new amount to set, without 0's. | function setMaxTxAmount(uint256 amount) external onlyOwner {
_maxTxAmount = amount * 10**9;
}
| 1,002,834 |
// SPDX-License-Identifier: MIT
/*
Created by DeNet
*/
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/math/Math.sol";
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "./interfaces/IUserStorage.sol";
import "./interfaces/IP... | not need, with using signature checking warning test function without checking DigitalSIgnature from User SEnding File | function _sendProofFrom(
address _proofer,
address _user_address,
uint32 _block_number,
bytes32 _user_root_hash,
uint64 _user_root_hash_nonce,
bytes calldata _file,
bytes32[] calldata merkleProof
) private {
require(
_proofer != address... | 1,055,772 |
pragma solidity ^0.4.11;
import "./Ownable.sol";
/**
* @title Heritable
* @dev The Heritable contract provides ownership transfer capabilities, in the
* case that the current owner stops "heartbeating". Only the heir can pronounce the
* owner's death.
*/
contract Heritable is Ownable {
address public heir;
... | Allows heir to transfer ownership only if heartbeat has timed out./ | function claimHeirOwnership() public onlyHeir {
require(!ownerLives());
require(now >= timeOfDeath + heartbeatTimeout);
OwnershipTransferred(owner, heir);
HeirOwnershipClaimed(owner, heir);
owner = heir;
timeOfDeath = 0;
}
| 13,125,974 |
./full_match/5/0xedC2471f9c73fC30422437f8370D6681c65C080B/sources/contracts/L1/rollup/StateCommitmentChain.sol | Removes a batch and all subsequent batches from the chain. _batchHeader Header of the batch to remove./ slither-disable-next-line reentrancy-events slither-disable-next-line reentrancy-events | function _deleteBatch(Lib_OVMCodec.ChainBatchHeader memory _batchHeader) internal {
require(_batchHeader.batchIndex < batches().length(), "Invalid batch index.");
require(_isValidBatchHeader(_batchHeader), "Invalid batch header.");
batches().deleteElementsAfterInclusive(
_batch... | 1,894,961 |
./full_match/43114/0x333BE852042F435431967664e09315CC63593333/sources/contracts/MultichainProxy.sol | It's safe to approve multichain on max amount, no need to check allowance there For multichain calls we use on-chain received amount, different amount spent can not happen Use this function only after external calls with bytes data _tokenIn token that we swapped on dex and approved _router the dex address _amountI... | function _amountAndAllowanceChecks(
address _tokenIn,
address _router,
uint256 _amountIn,
uint256 _tokenInAfter
) internal {
if (_tokenInAfter - IERC20Upgradeable(_tokenIn).balanceOf(address(this)) != _amountIn) {
revert DifferentAmountSpent();
}
... | 4,643,924 |
./full_match/80001/0x1ea36E48689c4345cFcd5f76a53A09CFb770aA90/sources/contracts/staking.sol | /// Convert the struct values to string Construct the metadata JSON object | function setTokenURI(uint256 tokenID) public {
User memory user = getUserByNFTID(tokenID);
string memory stakingAmountStr = uint256ToString(user.stakingAmount);
string memory stakingStatusStr = boolToString(user.stakingStatus);
string memory initialTimestampStr = uint256ToString(
... | 5,597,988 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
import "./IBEP20.sol";
import "./EIP918Interface.sol";
import "./interface/ApproveAndCallFallBack.sol";
import "openzeppelin-solidity/contracts/GSN/Context.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/p... | Sets `amount` as the allowance of `spender` over the `owner`s tokens. This is internal function is equivalent to `approve`, and can be used to e.g. set automatic allowances for certain subsystems, etc. Emits an {Approval} event. Requirements: - `owner` cannot be the zero address. - `spender` cannot be the zero address.... | function _approve(address owner, address spender, uint256 amount) internal {
require(owner != address(0), "BEP20: approve from the zero address");
require(spender != address(0), "BEP20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender... | 1,822,886 |
pragma solidity ^0.4.25;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
contract FlightSuretyData {
using SafeMath for uint256;
/********************************************************************************************/
/* DATA VARIABL... | Credits payouts to insurees/ | function creditInsurees(string flightName) external requireIsOperational {
for (uint c = 0; c < passengerArray.length; c++) {
if (keccak256(abi.encodePacked(passengerArray[c].flightNumber)) == keccak256(abi.encodePacked(flightName)) && passengerArray[c].isRegistered) {
a... | 15,806,765 |
./full_match/1/0xDa71df48bacaAD3BF64237829a172d956a9A7749/sources/contracts/Sale.sol | Forward funds to wallet. DAIAmount - amount of DAI or ETH to be transferred to the campaign wallet/ | function _forwardFunds(uint256 DAIAmount) internal {
if (msg.value > 0)
_wallet.transfer(msg.value);
else
IERC20(DAI).safeTransfer(_wallet, DAIAmount);
emit FundsForwarded(msg.value, DAIAmount);
}
| 9,740,976 |
./full_match/80001/0x1368452Bfb5Cd127971C8DE22C58fBE89D35A6BF/sources/contracts/SPImplementation.sol | token address => token decimals | function decimals(address token) external returns(uint256); | 5,610,194 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.