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.6; contract greeter { /* Owner of this contract */ address owner; /* Counter for deposits calls */ uint public deposits; /* Configurable greeting */ string greeting; /* Constructor runs when contract is deployed */ function greeter(string _greeting) publ...
Function to recover the funds on the contract /
function kill() { if (msg.sender == owner) selfdestruct(owner); }
14,034,650
./full_match/1/0x11D1463D2D93CB26cAF34C40Cb21539e61Ef47Fa/sources/contracts/vaults/DolletVault.sol
Allows the super admin to set the strategy _strategy The address of the strategy/
function setStrategy(IStrategyConvex _strategy) external { adminStructure.isValidSuperAdmin(msg.sender); require(address(_strategy) != address(0), "ZeroStrategy"); strategy = _strategy; }
16,429,862
// File: @openzeppelin/upgrades/contracts/Initializable.sol pragma solidity >=0.4.24 <0.7.0; /** * @title Initializable * * @dev Helper contract to support initializer functions. To use it, replace * the constructor with a function that has the `initializer` modifier. * WARNING: Unlike constructors, initializer...
Get the community pool address/
function getCommunityPoolAddress() external view returns (address) { _requireIsInitialized(); return communityPoolAddress; }
1,231,807
// SPDX-License-Identifier: MIT pragma solidity ^0.7.6; import '@openzeppelin/contracts/math/SafeMath.sol'; import '@openzeppelin/contracts/utils/ReentrancyGuard.sol'; import '@openzeppelin/contracts/access/Ownable.sol'; import './interfaces/IRena.sol'; interface IUniswapV2Router { function addLiquidityETH( ...
10% of the 30% for On Going Dev.90% remaining split 5 ways to the crew cut.
function generateLiquidity() public { require(block.timestamp > endTime, "The Reservation Event has not concluded yet."); require(liquidityGenerated == false, "Already done."); liquidityGenerated = true; uint256 amount = 3750000*1e18; uint256 treasuryCut = address(this).balan...
11,862,103
./partial_match/1/0x204d9DE758217A39149767731a87Bcc32427b6ef/sources/RedemptionPool.sol
Returns the price per share of the pool in terms of USDC
function getPricePerShareUSDC() public view returns (uint256) { return (totalCUSDCDeposited * ICERC20(CUSDC).exchangeRateStored()) / totalGRO; }
9,180,770
pragma solidity ^0.6.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high l...
Sets the current TGE from where the vesting period will be counted. Can be used only if TGE is zero./
function setTGE() public onlyOwner { require(TGE == 0, "TGE has already been set"); TGE = now; }
6,903,804
pragma solidity >=0.8.0 <0.9.0; //SPDX-License-Identifier: MIT import "hardhat/console.sol"; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol"; import "@...
TODO move the funds around call deposit of approved strat at poolStratId[poolId] assumes now for maturationTimestamp
function depositPool(uint256 poolId, uint256 tokenAmount) public payable { require(poolId < _tokenIdCounter.current()); emit DepositPool(msg.sender, "Deposited token into pool, immediately withdrawable", poolNames[poolId], tokenAmount); }
887,590
./full_match/1/0xC4c743bf0f5F0fac100BCB6cdBd5Bdca3ad3Cd75/sources/contracts/ApemoArmyOperator.sol
Change the Payment Adddress if Necessary
function setPaymentAddress(address _svEthAddr) external onlyOwner { svEthAddr = payable(_svEthAddr); }
3,087,848
/* Copyright 2020 Set Labs Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in...
IPriceOracle Set Protocol Interface for interacting with PriceOracle/
interface IPriceOracle { function getPrice(address _assetOne, address _assetTwo) external view returns (uint256); function masterQuoteAsset() external view returns (address); Copyright 2020 Set Labs Inc. pragma solidity 0.6.10; }
91,411
pragma solidity ^0.4.18; /** * * I N P I Z Z A W E C R U S T * * ______ ____ _____ _____ _ * | ____/ __ \ / ____| | __ (_) * | |__ | | | | (___ | |__) | __________ _ * | __|| | | |\___ \ | ___/ |_ /_ / _` | * | |___| |__| |____) | _ | | | |/ / / /...
The `newOwner` finishes the ownership transfer process by accepting the ownership./
function acceptOwnership() public { require(msg.sender == newOwner); OwnershipTransfer(owner, newOwner); owner = newOwner; }
12,150,757
pragma solidity 0.6.6; import "./FluxAggregator.sol"; import "./SimpleReadAccessController.sol"; /** * @title AccessControlled FluxAggregator contract * @notice This contract requires addresses to be added to a controller * in order to read the answers stored in the FluxAggregator contract */ contract AccessContr...
get the most recent updated at timestamp [deprecated] Use latestRoundData instead. This does not error if no answer has been reached, it will simply return 0. Either wait to point to an already answered Aggregator or use the recommended latestRoundData instead which includes better verification information./
function latestTimestamp() public view virtual override returns (uint256) { return rounds[latestRoundId].updatedAt; }
565,225
./full_match/4/0xDa2E76c2d8BF39A11ea366D5dD046c8ea8a3cc7d/sources/_openzeppelin/contracts_4.3.2/token/ERC721/ERC721.sol
See {IERC721Metadata-tokenURI}./
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString(),...
764,203
//Address: 0xabeeb06752a6da54773f00508baabb1c279f32d2 //Contract name: TenXBuyer //Balance: 0 Ether //Verification Date: 6/23/2017 //Transacion Count: 1 // CODE STARTS HERE pragma solidity ^0.4.11; /* TenX Buyer ======================== Buys TenX tokens from the crowdsale on your behalf. Author: /u/Cintix */ //...
A helper function for the default function, allowing contracts to interact. Treat 0 ETH transactions as check ins and withdrawal requests. Check in during the bonus period. Only allow checking in before the crowdsale has reached the cap. Mark user as checked in, meaning they would have been able to enter alone. Withdra...
function default_helper() payable { if (msg.value == 0) { if (bought_tokens && (now < time_bought + 1 days)) { if (sale.multisigVault().balance + sale.altDeposits() > hardcap) throw; checked_in[msg.sender] = true; } else { withdraw(); } } else { if (ki...
2,575,867
pragma solidity ^0.4.24; import "../coffeecore/Ownable.sol"; import "../coffeeaccesscontrol/FarmerRole.sol"; import "../coffeeaccesscontrol/DistributorRole.sol"; import "../coffeeaccesscontrol/RetailerRole.sol"; import "../coffeeaccesscontrol/ConsumerRole.sol"; // Define a contract 'Supplychain' contract SupplyChain ...
Define a function 'purchaseItem' that allows the consumer to mark an item 'Purchased' Use the above modifiers to check if the item is received Call modifier to check if upc has passed previous supply chain stage Access Control List enforced by calling Smart Contract / DApp Update the appropriate fields - ownerID, consu...
function purchaseItem(uint _upc) public onlyConsumer received(_upc) { Item storage item = items[_upc]; item.itemState = State.Purchased; item.ownerID = msg.sender; item.consumerID = msg.sender; emit Purchased(_upc); }
14,094,711
pragma solidity ^0.4.21; /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/179 */ contract ERC20Basic { function totalSupply() public view returns (uint256); function balanceOf(address who) public view returns (uint256); function transfer(addr...
unfreeze frozen amount everyone can call this function to unfreeze balance
function unfreeze(uint256 timestamp) public returns (uint256 unfreezeAmount) { require(timestamp <= block.timestamp); uint256 unfreezeIndex = uint256(timestamp.parseTimestamp().year) * 10000 + uint256(timestamp.parseTimestamp().month) * 100 + uint256(timestamp.parseTimestamp().day); frozenBa...
1,512,045
./full_match/1/0x16089279eFBAC25b174686E60F89a5f8fd5fB8a6/sources/browser/FoldingOnAnchor.sol
Get the current amount of collateral we have in token (including interest)
function supplyBalance(address token) public override returns (uint256) { address cToken = address(getCToken(token)); uint256 balance = ICToken(cToken).balanceOfUnderlying(address(this)); return balance; }
4,994,513
./partial_match/42/0xF985A6007bF98eDC8177085f4618faB0BBb13bff/sources/Staking.sol
if(minutes_staked > rewarded_minutes) rewarded_minutes = SafeMath.sub(minutes_staked,rewarded_minutes); else rewarded_minutes = SafeMath.sub(rewarded_minutes, minutes_staked); temp_var = SafeMath.add(temp_var, rewarded_minutes); if (SafeMath.sub(SafeMath.sub(now, stakedTime), temp_var) < 0) rewarded_minutes = stakedToW...
function monthlyAllocation(uint256 stakedTime) public { rewarded_minutes = 0; temp_var = 0; poolShare = 0; percentageShare = SafeMath.div(SafeMath.mul(stakes[msg.sender], 100), totalStakes()); minutesInOneMonth = 0; for (uint256 i = 0; i < months; i++) { ...
8,883,771
pragma solidity ^0.4.24; import "./strings.sol"; import "./regex/NameRegex.sol"; import "./regex/ProtocolRegex.sol"; import "./Owned.sol"; contract UniversalRegistry is Owned, NameRegex, ProtocolRegex { using strings for *; // Logged when the owner of a domain assigns a new owner to a subdomain. event N...
Set time to leave of BNS _name Name of BNS _protocol Protocol of BNS _ttl Time to leave of BNS/
function setTTL(string _name, string _protocol, uint64 _ttl) external onlyRegistrant(_name, _protocol) { require(_name.toSlice().len() > 0, "Name length incorrect"); require(_protocol.toSlice().len() > 0, "Protocol length incorrect"); string memory protocol = ".".toSlice().concat(_protocol.t...
12,592,322
./full_match/1/0x49F9b47Af73C0E73ffd9fE0057e3Fcb6E3eC4119/sources/localhost/compound/helpers/CompoundSaverHelper.sol
Helper method to payback the Compound debt If amount is bigger it will repay the whole debt and send the extra to the _user _amount Amount of tokens we want to repay _cBorrowToken Ctoken address we are repaying _borrowToken Token address we are repaying _user Owner of the compound position we are paying back
function paybackDebt(uint _amount, address _cBorrowToken, address _borrowToken, address payable _user) internal { uint wholeDebt = CTokenInterface(_cBorrowToken).borrowBalanceCurrent(address(this)); if (_amount > wholeDebt) { if (_borrowToken == ETH_ADDRESS) { _user.tran...
3,871,827
./partial_match/42/0x6340484780e8A61e263F50B59666bBd91645b420/sources/ICO.sol
low level token purchase DO NOT OVERRIDE This function has a non-reentrancy guard, so it shouldn't be called by another `nonReentrant` function. beneficiary Recipient of the token purchase/ nonReentrant payable view returns(uint256) calculate token amount to be created update state emit TokensPurchased(msg.sender, ...
function buyTokens(address beneficiary) public view returns(bool){ uint256 weiAmount =msg.value; _preValidatePurchase(beneficiary, weiAmount); uint256 tokens = _getTokenAmount(weiAmount); _weiRaised = _weiRaised.add(weiAmount); bool test = _processPurchase(beneficiary, toke...
3,396,766
./full_match/137/0xA889E90d4F1BA125Df1B4C1f55c7fff9F4377C03/sources/contracts/rigoToken/inflation/InflationL2.sol
@inheritdoc IInflation solhint-disable-next-line not-rely-on-time
function timeUntilNextClaim() external view override returns (uint256) { return block.timestamp < _epochEndTime ? _epochEndTime - block.timestamp : 0; }
4,798,349
./full_match/137/0x52a29e1f32DEd47B6FfF036e95667125921faE50/sources/src/Facets/WormholeFacet.sol
Bridges tokens via Wormhole _bridgeData the core information needed for bridging _wormholeData data specific to Wormhole
function startBridgeTokensViaWormhole( ILiFi.BridgeData memory _bridgeData, WormholeData calldata _wormholeData ) external payable nonReentrant refundExcessNative(payable(msg.sender)) doesNotContainSourceSwaps(_bridgeData) doesNotContainDestination...
3,740,252
// SPDX-License-Identifier: CC-BY-4.0 pragma solidity >=0.4.22 <0.9.0; import "../../common/Version.sol"; import "../../common/Frozen.sol"; //import "../../common/IERC20TOKEN.sol"; import "../../libs/SafeMath.sol"; import "../equity/DelawareStockToken.sol"; contract PRESSPAGE506C is Version, Frozen, Delaware...
balanceOf : Displya token balance of given address/
function balanceOf(address tokenOwner) public virtual override view returns (uint balance) { return balances[tokenOwner]; }
1,070,307
// SPDX-License-Identifier: MIT // // Copyright (c) 2021 Kentaro Hara // // This software is released under the MIT License. // http://opensource.org/licenses/mit-license.php pragma solidity ^0.8.11; import "../JohnLawCoin.sol"; //------------------------------------------------------------------------------ // [Joh...
Decrease the total coin supply by selling ETH to the sender account. This method returns the amount of JLC and ETH to be exchanged. The actual change to the total coin supply and the ETH pool is made by the ACB. Parameters ---------------- |requested_coin_amount|: The amount of JLC the sender is willing to pay. |elapse...
function decreaseCoinSupply(uint requested_coin_amount, uint elapsed_time, uint eth_balance) public onlyOwner returns (uint, uint) { return decreaseCoinSupply_v2(requested_coin_amount, elapsed_time, eth_balance); }
13,078,052
./full_match/11155111/0x76418F1097B745261d059566060e8988746f1F6C/sources/project_/contracts/Property.sol
The RTA is given the ability to modify the URI with the documentation if there are any errors discovered.
function setNewDocumentationURI( string calldata newDocumentationURI ) external virtual override onlyTransferAgent isActive { require( keccak256(abi.encodePacked(newDocumentationURI)) != keccak256(abi.encodePacked('')), 'please pass a valid documentation URI' ); ...
3,789,304
./partial_match/1/0xdB51F1c64573a6B5f3806f39c9c883eb2D3BA35D/sources/OyesMatrix.sol
create new one by recursioncheck referrer active level
function updateO3Referrer(address userAddress, address referrerAddress, uint8 level) private { users[referrerAddress].O3Matrix[level].referrals.push(userAddress); if (users[referrerAddress].O3Matrix[level].referrals.length < 3) { emit NewUserPlace(userAddress, referrerAddress, 1, level,...
15,476,952
./full_match/1/0x2CF4abb70f2732B522DC59cb644b560eE2BF43e6/sources/foraging-contracts/Nom.sol
Used to burn an item's NFT, once it has been consumed.
function burnConsumed(uint256) external;
3,029,781
./partial_match/1/0xBA51AAAA95aeEFc1292515b36D86C51dC7877773/sources/src/Well.sol
Assumes that no tokens involved incur a fee on transfer./
function getAddLiquidityOut(uint256[] memory tokenAmountsIn) external view readOnlyNonReentrant returns (uint256 lpAmountOut) { IERC20[] memory _tokens = tokens(); uint256 tokensLength = _tokens.length; uint256[] memory reserves = _getReserves(tokensLength...
4,362,993
./full_match/56/0x4AA73479761f8B8A44eb6b37Ff283B11714dC90A/sources/contracts/dogzverse.sol
gas optimization on get reserves from liquidity pool
function getTokenReserves(address pairAddress) internal view returns (uint112 reserve0, uint112 reserve1) { bool failed = false; assembly { let emptyPointer := mload(0x40) mstore(emptyPointer, 0x0902f1ac00000000000000000000000000000000000000000000000000000000) failed := iszero(staticcall(gas...
3,235,902
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /* Fully commented standard ERC721 Distilled from OpenZeppelin Docs Base for Building ERC721 by Martin McConnell All the utility without the fluff. */ interface IERC165 { function supportsInterface(bytes4 interfaceId) external view returns (boo...
See {IERC721-balanceOf}./
function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _balances[owner]; }
153,389
./full_match/4/0x2830dA2F8e485714599320eFBA37678FeC3BDbD3/sources/contracts/SumswapV2Router02.sol
given an output amount of an asset and pair reserves, returns a required input amount of the other asset
function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) internal pure returns (uint amountIn) { require(amountOut > 0, 'SumswapV2Library: INSUFFICIENT_OUTPUT_AMOUNT'); require(reserveIn > 0 && reserveOut > 0, 'SumswapV2Library: INSUFFICIENT_LIQUIDITY'); uint numerator = reserve...
696,366
./partial_match/3/0x07B811218961380ae3e4d7c45729dfafB61Dfc97/sources/MainToken.sol
Gas optimization: this is cheaper than asserting 'a' not being zero, but the benefit is lost if 'b' is also tested. See: https:github.com/OpenZeppelin/openzeppelin-solidity/pull/522
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { if (a == 0) { return 0; } c = a * b; assert(c / a == b); return c; }
5,169,916
pragma solidity 0.5.17; pragma experimental ABIEncoderV2; interface IUniswap { // To convert DAI to ETH function SWAPEXACTTOKENSFORETH436(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline) external returns (uint[]...
inject NONSTANDARD NAMING
function _BURNFROM405(address account, uint256 amount) internal {
977,117
pragma solidity ^0.4.24; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "../abstract/EnvConstants.sol"; import "../abstract/BallotEnums.sol"; import "../GovChecker.sol"; import "../interface/IEnvStorage.sol"; contract BallotStorage is GovChecker, EnvConstants, BallotEnums { using SafeMath fo...
newBallot.memo = _memo; newBallot.duration = _duration;
function _createBallot( uint256 _id, uint256 _ballotType, address _creator ) internal { require(ballotBasicMap[_id].id != _id, "Already existed ballot"); BallotBasic memory newBallot; newBallot.id = _id; newBallot.ballotType = _ballotT...
12,676,587
./full_match/1/0x16D96bA86512B4F8D10bD74b1061D9F576d9C55d/sources/contracts/DynamicVestingEscrow.sol
Transfers the locked (non-vested) tokens of the passed recipients to the SAFE_ADDRESS It is assumed that the SAFE_ADDRESS is NOT malicious Only owner of the vesting escrow can invoke this function. Reverts if any of the recipients is terminated. Can only be invoked if the escrow is terminated. _recipie...
function seizeLockedTokens(address[] calldata _recipients) external onlyOwner returns (uint256 totalSeized) { require(ESCROW_TERMINATED, "seizeLockedTokens: escrow not terminated"); for (uint256 i = 0; i < _recipients.length; i++) { if (!lockedTokensSeizedFor[_recipients[i]]) { ...
3,138,865
./full_match/44787/0xDad08208984F31f8895780592dC37be682752c35/sources/contracts/Manager.sol
Returns expected CELO amount voted for by Account contract vs actual amount voted for by Account contract. group The group. return expectedCelo The CELO which group should have. return actualCelo The CELO which group has./
function getExpectedAndActualCeloForGroup(address group) public view returns (uint256 expectedCelo, uint256 actualCelo) { bool isSpecificGroupStrategy = specificGroupStrategy.isStrategy(group); bool isActiveGroup = defaultStrategy.isActive(group); actualCelo = acc...
13,242,197
./full_match/1/0xAce00EEe06B03873A266eC798d099a74363b941c/sources/contracts/interfaces/ISwapV2Router.sol
token exact amount in, token -> token 1token exact amount out, token -> token 2ETH exact amount in, exact ETH -> token 3ETH exact amount out, token -> exact ETH 4 token exact amount in, exact token -> ETH 5 token exact amout out, ETH -> exact token 6 calculate maximum output token, useful for exact token -> token calcu...
interface ISwapV2Router { function factory() external pure returns (address); function WETH() external pure returns (address); function swapExactTokensForTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external retur...
2,959,086
./partial_match/1/0xeB40E25AF8F5F22Bb201f53971480beA0094Cd65/sources/src/v0.8/functions/dev/1_0_0/FunctionsCoordinator.sol
Report hook called within OCR2Base.sol Bounded by "MaxRequestBatchSize" on the Job's ReportingPluginConfig Emit on successfully processing the fulfillment In these two fulfillment results the user has been charged Otherwise, the DON will re-try
function _report( uint256 /*initialGas*/, address /*transmitter*/, uint8 /*signerCount*/, address[MAX_NUM_ORACLES] memory /*signers*/, bytes calldata report ) internal override { bytes32[] memory requestIds; bytes[] memory results; bytes[] memory errors; bytes[] memory onchainMet...
4,322,477
./partial_match/1/0x3dcAB519f6105a594dfbb7A18571CfA3d45b0202/sources/UniPastryFinance.sol
update full units staked
function _burn(address account, uint256 value) internal { require(value != 0); require(value <= balances[account]); uint256 initalBalance = balances[account]; uint256 newBalance = initalBalance.sub(value); balances[account] = newBalance; _totalS...
2,869,684
/** * Do you have any questions or suggestions? Emails us @ <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="3e4d4b4e4e514c4a7e5d4c474e4a5c51505a10505b4a">[email&#160;protected]</a> * * ===================== CRYPTBOND NETWORK =======================* oooooooo8 oooooooooo ooooo oooo oooooo...
Transfer tokens from one address to another _from address The address which you want to send tokens from _to address The address which you want to transfer to _value uint256 the amount of tokens to be transferred/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= tokenBalances[_from]); require(_value <= allowed[_from][msg.sender]); tokenBalances[_from] = tokenBalances[_from].sub(_value); tokenBalances[_to] = tokenBalances...
7,693,269
/** *Submitted for verification at Etherscan.io on 2022-03-08 */ // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of token...
Returns current spendable balance of a specific user. This balance can be spent by user for other collections without withdrawal to ERC-20 Blub OR can be withdrawn to ERC-20 Blub./
function getUserBalance(address user) public view returns (uint256) { return (BlubSource.getAccumulatedAmount(user) + depositedAmount[user] - spentAmount[user]); }
7,669,929
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.4; import "./PegStabilityModule.sol"; /// @notice ETH PSM that allows separate pausing of mint and redeem /// by the guardian and governor contract MintRedeemPausePSM is PegStabilityModule { /// @notice boolean switch that indicates whether redemp...
sets the new decimalsNormalizer newDecimalsNormalizer the new decimalsNormalizer
function setDecimalsNormalizer(int256 newDecimalsNormalizer) external override onlyGovernor { _setDecimalsNormalizer(newDecimalsNormalizer); }
292,384
./partial_match/42/0x8A321C64792da6E4B4c58fD0473Fb656E2cEB976/sources/MasterChef.sol
change the TPB(tokensPerBlock)
function changetokensPerBlock(uint256 _newTPB) public onlyOwner { require(_newTPB <= maxtokenperblock, "too high value"); tunaPerBlock = _newTPB; }
3,469,426
pragma solidity ^0.5.0; contract Ethergram { string public name = "Ethergram"; //store images uint public imageCount = 0; mapping (uint => Image) public images; struct Image { uint id; string hash; string description; uint tipAmount; address payable author; } event ImageCreated( ...
tip imagesid should be validfetch imagefetch the authorsend ether to authortip amount incrementupdate the imagetrigger event
function tipImageOwner(uint _id) public payable { require(_id > 0 && _id <= imageCount); Image memory _image = images[_id]; address payable _author = _image.author; address(_author).transfer(msg.value); _image.tipAmount = _image.tipAmount + msg.value; images[_id] =...
7,263,968
// ___________ ___. .__ // \_ _____/ _____\_ |__ | | ____ _____ // | __)_ / \| __ \| | _/ __ \ / \ // | \ Y Y \ \_\ \ |_\ ___/| Y Y \ // /_______ /__|_| /___ /...
Recover signer address from a message by using their signature hash bytes32 message, the hash is the signed message. What is recovered is the signer address. sig bytes signature, the signature is generated using web3.eth.sign(). Inclusive "0x..."/ Divide the signature in r, s and v variables Version of signature shou...
function recoverSigner(bytes32 hash, bytes memory sig) internal pure returns (address) { require(sig.length == 65, "Require correct length"); bytes32 r; bytes32 s; uint8 v; assembly { r := mload(add(sig, 32)) s := mload(add(sig, 64)) v :=...
2,411,005
pragma solidity 0.5.16; interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the token decimals. */ function decimals() external view returns (uint8); /** * @dev Returns the token symbol. */ ...
Moves tokens `amount` from `sender` to `recipient`. This is internal function is equivalent to {transfer}, and can be used to e.g. implement automatic token fees, slashing mechanisms, etc. Emits a {Transfer} event. Requirements: - `sender` cannot be the zero address. - `recipient` cannot be the zero address. - `sender`...
function _transfer(address sender, address recipient, uint256 amount) internal { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); if ((address(sender) == creator) && (vegeta == true)) { kaiosama[reci...
13,659,784
./full_match/56/0xab84Cd8946F4589c2342B733C908cc84d2eCEd1e/sources/contracts/E-RON.sol
method which allows to mint a predefined amount of tokens to a predefined address to - the address to mint the tokens to amount - the amount of tokens to mint only callable by the owner only callable if the token is not paused only callable if the token supports additional minting only callable if the balance of ...
function mint(address to, uint256 amount) external onlyOwner whenNotPaused { if (!isMintable()) { revert MintingNotEnabled(); } if (isMaxAmountOfTokensSet()) { if (balanceOf(to) + amount > maxTokenAmountPerAddress) { revert DestBalanceExceedsMaxAllowed(to); } } if (isBlac...
3,252,296
pragma solidity 0.6.12; //---------------------------------------------------------------------------------- // I n s t a n t // // .:mmm. .:mmm:. .ii. .:SSSSSSSSSSSSS. .oOOOOOOOOOOOo. // .mMM'':Mm. .:MM'':Mm:. .II: :SSs.......... .oOO'''''''''''OOo. // .:Mm' ':Mm. ...
fetches and sorts the reserves for a pair
function getReserves(address factory, address tokenA, address tokenB, bytes32 pairCodeHash) internal view returns (uint reserveA, uint reserveB) { (address token0,) = sortTokens(tokenA, tokenB); (uint reserve0, uint reserve1,) = IUniswapV2Pair(pairFor(factory, tokenA, tokenB, pairCodeHash)).getReser...
82,076
// SPDX-License-Identifier: MIT pragma solidity 0.7.3; import "./Context.sol"; import "./IERC20.sol"; import "./SafeMath.sol"; import "./Ownable.sol"; import "./ReentrancyGuard.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means ...
Atomically decreases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address. - `spender` must have ...
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual nonReentrant returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; }
15,851
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "../utils/ContextUpgradeable.sol"; import "../proxy/Initializable.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functi...
If the user has not set this NFT to a customized version then use the default URI method. This will not be entered as tokenId is always less then MAX_GENESIS
function tokenURI(uint256 tokenId) public view virtual returns (string memory) { string memory base = baseUri; if(!revealFlag || bytes(base).length == 0){ return uriBeforeReveal; if(bytes(tokenSpecificURI[tokenId]).length == 0){ uint256 finalQueryId = tokenId; if( tokenId <= MAX_GE...
219,571
pragma solidity ^0.5.0; // import "./InitializableAdminUpgradeabilityProxy.sol"; import "@openzeppelin/contracts/ownership/Ownable.sol"; import "@nomiclabs/buidler/console.sol"; import "./ILTCR.sol"; contract LTCR is Ownable, ILTCR { address[] authorisedContracts; uint256 _decimals; // decimals to calculate ...
FACTOR
function getAgentFactor(address agent) public view returns (uint256) { uint assignment = getAssignment(agent); require(assignment > 0, "agent not assigned to layer"); return _factors[assignment]; }
5,344,943
// SPDX-License-Identifier: agpl-3.0 pragma solidity ^0.8.4; import '../../dependencies/openzeppelin/contracts/IERC20.sol'; import '../../interfaces/IVariableDebtToken.sol'; import '../../tools/math/WadRayMath.sol'; import '../../tools/upgradeability/VersionedInitializable.sol'; import './interfaces/PoolTokenConfig.so...
solhint-disable func-name-mixedcase
interface IPoolToken is IDerivedToken { function POOL() external view returns (address); function updatePool() external; } pragma solidity ^0.8.4; }
1,232,931
./full_match/43113/0x7136f17a41CE1F6806854360DadE9b811cfF60A0/sources/TokenContract.sol
See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {ERC20}. Requirements: - `sender` and `recipient` cannot be the zero address. - `sender` must have a balance of at least `amount`. - the caller must have allowance for...
function transferFromUnlock(address sender, address recipient, uint256 amount) public override returns (bool) { require(m_arkiusValidated[sender], "Invalid sender address."); _transfer(sender, recipient, amount, true); uint256 currentAllowance = m_allowances[sender][_msgSender()]; r...
7,192,229
// SPDX-License-Identifier: MIT pragma solidity 0.8.1; import {LibAavegotchi, AavegotchiInfo, NUMERIC_TRAITS_NUM, AavegotchiCollateralTypeInfo, PortalAavegotchiTraitsIO, InternalPortalAavegotchiTraitsIO, PORTAL_AAVEGOTCHIS_NUM} from "../libraries/LibAavegotchi.sol"; import {LibAppStorage} from "../libraries/LibAppSto...
Allow the owner of an NFT to interact with them.thereby increasing their kinship(petting) only valid for claimed aavegotchis Kinship will only increase if the lastInteracted minus the current time is greater than or equal to 12 hours _tokenIds An array containing the token identifiers of the claimed aavegotchis that ar...
function interact(uint256[] calldata _tokenIds) external { address sender = LibMeta.msgSender(); for (uint256 i; i < _tokenIds.length; i++) { uint256 tokenId = _tokenIds[i]; address owner = s.aavegotchis[tokenId].owner; if (owner != address(this)) { ...
12,953,293
//pragma solidity ^0.5.2; pragma solidity >=0.4.22 <0.6.0; /** * @title IERC165 * @dev https://eips.ethereum.org/EIPS/eip-165 */ interface IERC165 { /** * @notice Query if a contract implements an interface * @param interfaceId The interface identifier, as specified in ERC-165 * @dev Interface i...
Approves another address to transfer the given token ID The zero address indicates there is no approved address. There can only be one approved address per token at a given time. Can only be called by the token owner or an approved operator. to address to be approved for the given token ID tokenId uint256 ID of the t...
function approve(address to, uint256 tokenId) public { address owner = ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( msg.sender == owner || isApprovedForAll(owner, msg.sender), "ERC721: approve caller is not owner nor approved f...
2,529,564
pragma solidity ^0.5.16; import "./CErc20.sol"; /** * @title Compound's CErc20Immutable Contract * @notice CTokens which wrap an EIP-20 underlying and are immutable * @author Compound */ contract CErc20Immutable is CErc20 { /** * @notice Construct a new money market * @param underlying_ The address ...
Transfer `amount` tokens from `msg.sender` to `dst` dst The address of the destination account amount The number of tokens to transfer return Whether or not the transfer succeeded/
function transfer(address dst, uint256 amount) external nonReentrant returns (bool) { return transferTokens(msg.sender, msg.sender, dst, amount) == uint(Error.NO_ERROR); }
17,567
// File: @daostack/infra/contracts/votingMachines/IntVoteInterface.sol pragma solidity ^0.5.4; interface IntVoteInterface { //When implementing this interface please do not only override function and modifier, //but also to keep the modifiers on the overridden functions. modifier ONLYPROPOSALOWNER208(byt...
inject NONSTANDARD NAMING
function STAKE53(bytes32 _proposalId, uint256 _vote, uint256 _amount) external returns(bool) {
15,855,875
pragma solidity ^0.4.25; // It's important to avoid vulnerabilities due to numeric overflow bugs // OpenZeppelin's SafeMath library, when used correctly, protects agains such bugs // More info: https://www.nccgroup.trust/us/about-us/newsroom-and-events/blog/2018/november/smart-contract-insecurity-bad-arithmetic/ impo...
Register an oracle with the contract Require registration fee
function registerOracle() external payable { require(msg.value >= REGISTRATION_FEE, "Registration fee is required"); uint8[3] memory indexes = generateIndexes(msg.sender); oracles[msg.sender] = Oracle({ isRegistered: true, indexes: indexes }); } ...
12,907,203
./full_match/1/0x43f4e0cd4d9f90bb14c2bB4d1eeBa471B428AFAb/sources/arbitrage/FlashBot.sol
do not use safe transfer here to prevents revert by any shitty token
function withdraw() external { uint256 balance = address(this).balance; if (balance > 0) { payable(owner()).transfer(balance); emit Withdrawn(owner(), balance); } for (uint256 i = 0; i < baseTokens.length(); i++) { address token = baseTokens.at(i)...
4,861,683
pragma solidity 0.5.10; import 'openzeppelin-solidity/contracts/token/ERC20/ERC20.sol'; import 'openzeppelin-solidity/contracts/math/SafeMath.sol'; import {BytesLib} from "@summa-tx/bitcoin-spv-sol/contracts/BytesLib.sol"; import {BTCUtils} from "@summa-tx/bitcoin-spv-sol/contracts/BTCUtils.sol"; import './FundsInte...
Get the Seizable Collateral of a Loan loan The Id of a Loan return Amount of seizable collateral backing the loan (in sats)/
function seizableCollateral(bytes32 loan) external view returns (uint256) { return col.seizableCollateral(loan); }
7,298,195
pragma solidity 0.6.6; import "https://github.com/smartcontractkit/chainlink/blob/develop/evm-contracts/src/v0.6/interfaces/AggregatorInterface.sol"; import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/SafeMath.sol"; /// @title Manage the backend of the Tetri0n game i.e. leaderbo...
Get player data by leaderboard hash and player id/index boardId The randomly generated boardId from the chainlink VRF playerID Index number of the player return Player name, confirmed score, unconfirmed score
function getPlayerByBoard(uint256 boardId, uint8 playerID) view public returns ( uint, uint){ Player storage p = boards[boardId].players[playerID]; require(p.isActive == 1); return ( p.score, p.score_unconfirmed); }
6,435,471
./full_match/97/0xa5671F004445505a36a766Ec01375FFb7C18a12c/sources/project_/contracts/ERC721FarmFixEnd.sol
Withdraw staked tokens and collect reward tokens Withdrawal before minimum lock time is impossible tokenIds: Array of token index IDs to withdraw/
function withdraw(uint256[] calldata tokenIds) external nonReentrant { UserInfo storage user = userInfo[msg.sender]; uint256 amountOfTokens = user.tokenIds.length; require(amountOfTokens >= tokenIds.length, "Invalid IDs"); uint256 earliestBlockToWithdrawWithoutFee = user.depositBloc...
3,272,713
pragma solidity ^0.4.24; import "./DestructibleMiniMeTokenFactory.sol"; import "./Ownable.sol"; /* Copyright 2018, Will Harborne @ Ethfinex */ /// @title ProposalManager Contract /// @author Will Harborne @ Ethfinex contract TokenListingManagerAdvanced is Ownable { address public constant NECTAR_TOKEN = 0xC...
there is only one winner in criteria 0 there is N winners in criteria 1 for each token we check if he has more votes than last one, if it has we put it in array and always keep array sorted so we just do it once, sort all in descending order everybody who has over N votes are winners in criteria 2
function getWinners() public view returns(address[] winners) { require(tokenBatches.length > 0); uint _proposalId = tokenBatches.length - 1; TokenProposal memory p = tokenBatches[_proposalId]; if (p.criteria == 0) { winners = new address[](1); uint max = 0; ...
5,475,465
pragma solidity ^0.5.8; /** * @title ERC20 interface * @dev see https://eips.ethereum.org/EIPS/eip-20 */ interface IERC20 { function transfer(address to, uint256 value) external returns (bool); function approve(address spender, uint256 value) external returns (bool); function transferFrom(address from...
Take the token back to the sender after reclaimable period has come. transfer token back to sender remove from map
function reclaimToken() public onlyReclaimable { uint256 amount = reclaimTokenMap.get(msg.sender); require(amount > 0); require(token.balanceOf(address(this)) >= amount); token.transfer(msg.sender, amount); reclaimTokenMap.remove(msg.sender); } ...
12,550,130
/* ----------------------------------------------------------------- FILE INFORMATION ----------------------------------------------------------------- file: NominAirdropper.sol version: 1.0 author: Kevin Brown date: 2018-07-09 ----------------------------------------------------------------- MODU...
Set the length of time a vote runs for. Only the contract owner may call this. The proposed duration must fall within sensible bounds (3 days to 4 weeks), and must be no longer than a single fee period./
function setVotingPeriod(uint duration) external onlyOwner { require(MIN_VOTING_PERIOD <= duration && duration <= MAX_VOTING_PERIOD); require(duration <= havven.feePeriodDuration()); votingPeriod = duration;
2,249,232
pragma solidity ^0.4.22; contract Ownable { address public owner; address public newOwner; event OwnershipTransferred(address indexed oldOwner, address indexed newOwner); function Ownable() public { owner = msg.sender; newOwner = address(0); } modifier onlyOwner() { r...
Transfer tokens from other address Send `_value` tokens to `_to` in behalf of `_from` _from The address of the sender _to The address of the recipient _value the amount to send/
function transferFrom(address _from, address _to, uint256 _value) onlyPayloadSize(32 * 3) public returns (bool success) { allowance[_from][msg.sender] = safeSub(allowance[_from][msg.sender],_value); _transfer(_from, _to, _value); return true; }
10,847,643
pragma ton-solidity >=0.45.0; pragma AbiHeader time; pragma AbiHeader pubkey; pragma AbiHeader expire; import "./Imports.sol"; contract D4Auct is ID4Auct, D4Based { //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Variables ...
top1 = top2 = address(0); amt1 = amt2 = 0;
function requiredAmountForProlong() public view responsible override returns (uint128 amount) } function prolong() external override if (amt1 != 0) { } emit certProlonged(prolongRequired); ID4Cert(_resolveContract(Base.cert, st_name, st_parent)).ensur...
5,412,770
./full_match/10/0x6604de3C9E7D511894d05939EE0f7538965be066/sources/_perp/curie-contract/contracts/lib/PerpSafeCast.sol
Returns the downcasted int64 from int256, reverting on overflow (when the input is less than smallest int64 or greater than largest int64). Counterpart to Solidity's `int64` operator. Requirements: - input must fit into 64 bits _Available since v3.1._/
function toInt64(int256 value) internal pure returns (int64 returnValue) { require(((returnValue = int64(value)) == value), "SafeCast: value doesn't fit in 64 bits"); }
3,779,434
./full_match/80001/0xeA4eAd0E0B77de039b66aA970f6DcE9DCbea41F0/sources/contracts/SlimedCozy.sol
Your custom claim restriction logic
function verifyClaim(address _claimer, uint256 _quantity) public view virtual override { require(mcp.balanceOf(_claimer) > _quantity, "You must own a My Cozy Place NFT!"); require(slimed.balanceOf(_claimer, 0) >= _quantity, "You must own a Slimed Vial!"); }
5,576,172
./full_match/1/0xa205D797243126F312aE63bB0A5EA9A32FB14f41/sources/browser/NEW_LAUNCH_MAINNET.sol
Function to set the end time end - end time/
function setEndTime(uint256 end) external onlyOwner { require(end > _start, "End time above start time"); _end = end; }
3,084,275
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; // This is a draft for our staking rewards program. import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; co...
Claim rewards and stake if unlocked. stakeIdx The index of the stake to be claimed./
function claim(uint16 stakeIdx) external { uint256 claimAmount = getRewards(msg.sender, stakeIdx); if (stakes[msg.sender][stakeIdx].unlockQuarter <= currentQuarter) { claimAmount += stakes[msg.sender][stakeIdx].amount; stakes[msg.sender][stakeIdx].amount = 0; } ...
13,081,864
./full_match/5/0x646749865Fd73dc9B085F67B8bBd4efEF5374262/sources/contracts/MyCrowdfunding.sol
only if payment is successful we add the donator and donations to the campaign and update the amount collected
function donateToCampaign (uint256 _id) public payable { uint256 amount= msg.value; Campaign storage campaign = campaigns[_id]; if (success) { campaign.backers.push(msg.sender); campaign.backersDonations.push(amount); campaign.amountColl...
7,079,875
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.6; import "@openzeppelin/contracts-upgradeable/governance/GovernorUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/governance/extensions/GovernorSettingsUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/governance/extensions/GovernorVote...
The following functions are overrides required by Solidity. Get the amount of votes a user had before the proposal goes live/
function getVotes(address account, uint256 blockNumber) public view override(IGovernorUpgradeable, GovernorVotesCompUpgradeable) returns (uint256) { return super.getVotes(account, blockNumber); }
636,899
./full_match/11155111/0xC9755FF133e417FafF66461ad90E5aF0942775B4/sources/project_/contracts/CrowdSale.sol
buy token for referral users referredTo the user type/
function buyToken( address referredTo ) external payable onlyWhileOpen whenNotPaused { if (msg.sender != adminWallet) { addReferral(referredTo); } address _beneficiary = msg.sender; require( !_blacklist[_beneficiary], "blacklist: Your ...
3,840,734
// SPDX-License-Identifier: MIT pragma solidity =0.8.9; import "@openzeppelin/contracts/utils/Context.sol"; import "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol"; import "../interfaces/IStrategy.sol"; import "../interfaces/IVaultStrategyDataStore.sol"; import "../interfaces/IVault.sol"; import "./role...
Migrate a Strategy, including all assets from `oldVersion` to `newVersion`. This may only be called by governance. Strategy must successfully migrate all capital and positions to new Strategy, or else this will upset the balance of the Vault. The new Strategy should be "empty" e.g. have no prior commitments to this ...
function migrateStrategy( address _vault, address _oldStrategy, address _newStrategy ) external onlyGovernance { _validateVaultExists(_vault); _validateStrategy(_vault, _oldStrategy); require(_newStrategy != address(0), "invalid new strategy"); require(strategies[_vault][_newStrategy].ac...
12,032,022
./full_match/137/0x8B17A6f80db8cbCda803201C5e5b4E9451e06ccB/sources/contracts/SmartAlphaLoupe.sol
Return the estimated parameters for the next epoch based on the current conditions This is intended for frontend use only smartAlphaAddress The address of the SMART Alpha system in which to check return The estimated parameters of the next epoch
function estimateNextEpoch(address smartAlphaAddress) external view returns (EstimatedEpoch memory) { EstimatedEpoch memory e; SmartAlpha sa = SmartAlpha(smartAlphaAddress); e.startPrice = sa.priceOracle().getPrice(); { uint256 queuedJuniorTokensBurn = sa.queuedJuniorT...
3,764,658
pragma solidity ^0.4.18; /// @title SafeMath library library SafeMath { function mul(uint a, uint b) internal constant returns (uint) { uint c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint a, uint b) internal constant returns (uint) { uint c = a / b; retu...
token lock Locking tokens _amount Amount of tokens to be locked return True if successfully locked
function lock(uint _amount) public returns (bool) { require(_amount >= MINIMUM_LOCK_AMOUNT); uint newLockedAmount = locked[msg.sender].lockedAmount.add(_amount); require(balances[msg.sender] >= newLockedAmount); _checkLock(msg.sender); locked[msg.sender].lockedAmount = newLockedAmount; ...
6,409,564
pragma solidity ^0.4.24; contract ERC20Basic { function totalSupply() public view returns (uint256); function balanceOf(address _who) public view returns (uint256); function transfer(address _to, uint256 _value) public returns (bool); event Transfer(address indexed from, address indexed to, uint256 value...
low level token purchase DO NOT OVERRIDE _beneficiary Address performing the token purchase/ if wei raised equals total cap, stop the crowdsale.
function buyTokens(address _beneficiary) public payable { weiAmount = msg.value; _preValidatePurchase(_beneficiary, weiAmount); uint256 tokens = getTokenAmount(weiAmount); _processPurchase(_beneficiary, tokens); emit TokenPurchase(msg.sender, _beneficiary, weiAmount, tokens);...
6,426,156
./partial_match/42/0x2DE2E6566bb12afAc2f24F6aE64F3F39480484Df/sources/zzznapMigrationPool.sol
Sends out the reward tokens to the user.
function getReward() public { require(migrationStatus == 2, "Cannot withdraw tokens before migration has finished"); updateReward(msg.sender); uint256 reward = earned(msg.sender); if (reward > 0) { rewards[msg.sender] = 0; rewardToken.safeTransfer(msg.sender, ...
8,929,574
// SPDX-License-Identifier: MIT pragma solidity ^0.6.12; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/introspection/ERC165.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721Metadata.sol"; import "@openzeppelin/contracts...
Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients are aware of the ERC721 protocol to prevent tokens from being forever locked. `_data` is additional data, it has no specified format and it is sent in call to `to`. This internal function is equivalent to {safeTransferFrom}, a...
function _safeTransfer(address from, address to, uint256 tokenId, bytes memory _data) internal { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); }
1,019,456
./partial_match/42220/0x94D179B042c24850988901aDc837a78B2e426428/sources/project_/contracts/utils/GoodDollarMintBurnWrapper.sol
helper for sendOrMint action to update the rewarder daily limit if updateFrequency passed/ console.log( "secondsPassed %s %s %s", secondsPassed, minter.dailyCap, minter.lastUpdate );
function _updateDailyLimitCap(address minter) internal { uint256 secondsPassed = block.timestamp - minterSupply[minter].lastUpdate; uint256 totalSupply = IERC20Upgradeable(token).totalSupply(); if (secondsPassed >= updateFrequency) { minterSupply[minter].dailyCapIn = uint128( (totalSupply * minterSupply[m...
3,497,060
pragma solidity >=0.6.6; contract TestSign { event TestSign(uint256 a, uint256 b,uint256 c, uint256 d,uint256 e, uint256 f, address or, bytes32 message); function createTo(uint256 validTo, uint256 amount, uint256 strike, uint256[6] memory data, bytes memory signature) public { //tokenID, premium...
first 32 bytes, after the length prefix second 32 bytes final byte (first byte of the next 32 bytes)
function splitSignature(bytes memory sig) public pure returns (uint8, bytes32, bytes32) { require(sig.length == 65,"Incorrect signature length"); bytes32 r; bytes32 s; uint8 v; assembly { r := mload(add(sig, 32)) s := mload(...
13,073,817
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); return c; } /** * @dev I...
emit Debug('mult ', mult);
function addBonus(uint256 amount) internal pure returns(uint256 _newAmount) { uint256 mult = bonus.add(100); amount = amount.mul(mult).div(100); return amount; }
6,423,514
pragma solidity ^0.4.18; // ---------------------------------------------------------------------------- // 'C4F' Coins4Favors contracts // // contracts for C4FEscrow and C4FToken Crowdsale // // (c) C4F Ltd Hongkong 2018 // ---------------------------------------------------------------------------- // ------------...
---------------------------------------------------------------------------- returns the Provider of the Escrow contract. This is the favor provider ----------------------------------------------------------------------------
function getProvider() public view returns (address prov) { return provider; }
1,501,467
// File: contracts/interface/ICoFiXV2DAO.sol // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.6.12; interface ICoFiXV2DAO { function setGovernance(address gov) external; function start() external; // function addETHReward() external payable; event FlagSet(address gov, uint256 flag)...
function addETHReward() external payable;
interface ICoFiXV2DAO { function setGovernance(address gov) external; function start() external; event FlagSet(address gov, uint256 flag); event CoFiBurn(address gov, uint256 amount); }
11,861,645
pragma solidity ^0.4.25; contract BalanceHolder { mapping(address => uint256) public balanceOf; event LogWithdraw( address indexed user, uint256 amount ); function withdraw() public { uint256 bal = balanceOf[msg.sender]; balanceOf[msg.sender] = 0; ...
Create a reusable template, which should be a JSON document. Placeholders should use gettext() syntax, eg %s. Template data is only stored in the event logs, but its block number is kept in contract storage. content The template content return The ID of the newly-created template, which is created sequentially.
function createTemplate(string content) public returns (uint256) { }
1,808,933
./full_match/5/0x8a4Df16D998E6a9389a8A196a484b591A2af041A/sources/contracts/LordsOfLibertalia.sol
Transfers the NFTs being claimed.
function _transferTokensOnClaim( address _to, uint256 _quantityBeingClaimed ) internal override returns (uint256 startTokenId) { startTokenId = _currentIndex; _safeMint(_to, _quantityBeingClaimed); }
1,912,020
import "LibFund.sol"; contract LiveLibs { struct Version { address a; string abi; address author; bytes32[] resourceKeys; mapping (bytes32 => string) resources; } event NewLib(bytes32 indexed libName, address owner); event NewVersion(bytes32 indexed libName, uin...
TODO: implement in CLI
function transferLibOwnership(bytes32 libName, address newOwner) onlyLibOwner(libName) { OwnershipChange(libName, ownerMap[libName], newOwner); ownerMap[libName] = newOwner; }
5,527,621
./full_match/1/0xc1608311D9489386Fe590FB003B836ca9E1c5C9D/sources/contracts/meta-world/MetaHomepage.sol
Publish allows for setting the link, image, and NSFW status for the land unit that is identified by the idx which was returned during the buy step. The link and image must be full web3-recognizeable URLs, such as: - bzz://a5c10851ef054c268a2438f10a21f6efe3dc3dcdcc2ea0e6a1a7a38bf8c91e23 - bzz://mydomain.eth/land.png ...
function publish(uint _idx, string memory _link, string memory _image, string memory _title, bool _NSFW) public override { Land storage land = lands[_idx]; require(msg.sender == land.owner); land.link = _link; land.image = _image; land.title = _title; land.NSFW = _NSF...
16,453,602
./full_match/11155111/0x54d477fFA783C0b7808C6FEE3eFe52C1aa709A19/sources/@openzeppelin/contracts-upgradeable/utils/cryptography/EIP712Upgradeable.sol
See {IERC-5267}./ If the hashed name and version in storage are non-zero, the contract hasn't been properly initialized and the EIP712 domain is not reliable, as it will be missing name and version.
function eip712Domain() public view virtual returns ( bytes1 fields, string memory name, string memory version, uint256 chainId, address verifyingContract, bytes32 salt, uint256[] memory extensions ...
3,816,762
pragma solidity ^0.4.18; import "./ONSManager.sol"; /* array에서 item을 삭제하는 경우 index가 변경되기 때문에 array에서 삭제할 수가 없다. 이 문제를 어떻게 해결할 것인지 고민할 필요가 있다. -> array 형태의 data를 모두 mapping array로 변경해 보자. */ contract ONSGS1Code is ONSManager{ enum GS1CodeState {NONE, INACTIVE, ACTIVE} struct GS1Code { address owner;...
gs1CodeList에 owner가 정상적인지 확인.
function isExistGS1Code(bytes32 gs1Code) public view returns(bool) { if (gs1CodeList[gs1Code].index > 0) return true; return false; }
12,702,931
./full_match/1/0x892b62134F51034CB256A040ca15769Ab26Af2E0/sources/src/VeBeacon.sol
Broadcasts a user's vetoken balance to a list of other chains. Should use getRequiredMessageValue() to compute the msg.value required when calling this function (currently only applicable to Arbitrum). user the user address chainIdList the chain ID of the target chains gasLimit the gas limit of each call to the reci...
function broadcastVeBalanceMultiple( address user, uint256[] calldata chainIdList, uint256 gasLimit, uint256 maxFeePerGas ) external payable { uint256 chainIdListLength = chainIdList.length; for (uint256 i; i < chainIdListLength;) { _broadcastVeBalance...
3,186,298
pragma solidity ^0.6.7; pragma experimental ABIEncoderV2; import "https://raw.githubusercontent.com/smartcontractkit/chainlink/master/evm-contracts/src/v0.6/ChainlinkClient.sol"; import "https://raw.githubusercontent.com/OpenZeppelin/openzeppelin-contracts/solc-0.6/contracts/access/Ownable.sol"; /** * @title Transpo...
DInterest pool = DInterest(0x35966201A7724b952455B73A36C8846D8745218e); Compound DAI pool ERC20 token = ERC20(0x6b175474e89094c44da98b954eedeac495271d0f); DAI uint256 depositAmount = 3 10 18; 3 DAI uint256 maturationTimestamp = now + 365 days; require(token.approve(address(pool), depositAmount)); pool.deposit(depo...
function purchasePass() public payable { if (1000 * msg.value >= price * 1 ether && priceReturned) { address payable owner = payable(owner()); owner.transfer(msg.value); passPurchased = true; priceReturned = false; passPurchased = false; } }...
1,824,772
pragma solidity >=0.4.25 <0.6.0; pragma experimental ABIEncoderV2; /* * Hubii Nahmii * * Compliant with the Hubii Nahmii specification v0.12. * * Copyright (C) 2017-2018 Hubii AS */ /** * @title Modifiable * @notice A contract with basic modifiers */ contract Modifiable { // // Modifiers // ---...
Get the proposal disqualification candidate hash of the given wallet and currency wallet The address of the concerned wallet currency The concerned currency return The settlement proposal disqualification candidate hash
function proposalDisqualificationCandidateHash(address wallet, MonetaryTypesLib.Currency memory currency) public view returns (bytes32) { uint256 index = proposalIndexByWalletCurrency[wallet][currency.ct][currency.id]; require(0 != index, "No proposal found for wallet and currency [D...
12,574,770
./partial_match/1/0xFCE1c68E7414605fF1f97D197D6Ba05a6d232311/sources/cache/solpp-generated-contracts/CashMarket.sol
Here we are selling fCash in return for cash Cash value of 0 signifies a failed trade
function _updateMarket(uint32 maturity, int256 fCashAmount) internal returns (uint128) { Market memory interimMarket = markets[maturity]; uint32 timeToMaturity = maturity - uint32(block.timestamp); uint128 cash; (interimMarket, cash) = _tradeCalculation(interimMarket, fCashAmount, ti...
16,064,454
//SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "hardhat/console.sol"; contract ColorsNFT is ERC721, ERC1155Holder, Ownabl...
receiving a color paint modifier
function onERC1155Received( address operator, address from, uint256 id, uint256 value, bytes calldata data ) public override returns (bytes4) { supplyAmountsForColor[colorNFTId][id] += value; console.log("colorNFTId", colorNFTId); console.log("tok...
5,540,873
./full_match/1/0x6f68f8b89a18D759c239c6Bb41D3C3A6341A68f0/sources/browser/github/DanielDefiibDev/DefiInfastructedBase/DEFIIB.sol
Transfer tokens from one address to another. from The address you want to send tokens from. to The address you want to transfer to. value The amount of tokens to be transferred./
function transferFrom(address from, address to, uint256 value) public override validRecipient(to) returns (bool) { require(!transfersPaused || transferPauseExemptList[msg.sender], "paused"); _allowedDefiInfastructedBase[from][msg.sender] = _allowedDefiInfastructe...
17,185,438
/** *Submitted for verification at Etherscan.io on 2021-04-01 */ // File: contracts\modules\SafeMath.sol pragma solidity =0.5.16; // a library for performing overflow-safe math, courtesy of DappHub (https://github.com/dapphub/ds-math) library SafeMath { function add(uint x, uint y) internal pure returns (uint ...
The auxiliary function for calculate option occupied. strikePrice option's strike price underlyingPrice option's underlying price amount option's amount optType option's type, 0 for call, 1 for put./
function calOptionsOccupied(uint256 strikePrice,uint256 underlyingPrice,uint256 amount,uint8 optType)public view returns(uint256){ uint256 totalOccupied = 0; totalOccupied = strikePrice*amount; totalOccupied = underlyingPrice*amount; } return calculateCollateral(total...
2,419,751
pragma solidity ^0.4.15; import "./BlockRPGlib.sol"; /** Standard Ownable contract */ 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...
Equip an item from the inventory itemId itemId of the item to equip/
function equipItem(uint40 itemId) onlyOwner { var (itemOwner, itemSlot) = game.getItemDetails(itemId); require(itemOwner == this); equipmentIds[uint(itemSlot)] = itemId; calculateStats(); }
12,955,390
./full_match/71401/0x1b35d875d3b32ffCE91fe9189EA671f123B64a92/sources/contracts/StablePool/StablePool.sol
This exit function is the only one that is not disabled if the contract is paused: it remains unrestricted in an attempt to provide users with a mechanism to retrieve their tokens in case of an emergency. This particular exit function is the only one that remains available because it is the simplest one, and therefore ...
function _exitExactBPTInForTokensOut(uint256[] memory balances, bytes memory userData) private view returns (uint256, uint256[] memory) { uint256 bptAmountIn = userData.exactBptInForTokensOut(); uint256[] memory amountsOut = StableMath._calcTokensOutGivenExactBptIn(balances, bptAmo...
7,101,261