file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
./full_match/1/0x5E57C528EF9126200D76620e7b843600635E74Ca/sources/sir-token.sol
Sets amount_ as the allowance of spender_ over the owner`s tokens. This internal function is equivalent to `approve`, and can be used to e.g. set automatic allowances for certain subsystems, etc. Emits: {Approval} event. Required: - owner_ can't be zero address. - spender_ can't be zero address./
function _approve( address owner_, address spender_, uint256 amount_ ) private { validAddress(owner_); validAddress(spender_); _allowances[owner_][spender_] = amount_; emit Approval(owner_, spender_, amount_); }
17,066,088
./full_match/5/0x9d45d05494eD6E8964a3818E506C8488a4FEBb82/sources/Users/seb/repo/hunt/neverlose/contract/contracts/WRNRewardPool.sol
NOTE: This could fail with out-of-gas if too many tokens are added. If this fails, the owner MUST update all pools manually Decreasing multiplier shouldn't be allowed without `updateAllPools` calls because users can temporarily withdraw a bigger WRN reward than they actually have (caused by smaller `totalMultiplier` =>...
function updatePoolMultiplier(address tokenAddress, uint256 multiplier, bool shouldUpdate) external onlyOwner { require(multiplier >= 0, 'INVALID_MULTIPLIER'); if(shouldUpdate) { updateAllPools(); revert('UPDATE_ALL_REQUIRED'); } totalMultiplier = totalMultiplier - wrnStats[tokenAddress...
1,953,367
pragma solidity 0.4.24; import "zeppelin-solidity/contracts/token/ERC721/ERC721Token.sol"; import "zeppelin-solidity/contracts/math/SafeMath.sol"; import "./lib/strings.sol"; // References: https://github.com/OpenZeppelin/openzeppelin-solidity/blob/v1.8.0/contracts/token/ERC721/ERC721Token.sol contract DMB is ERC721T...
constructorDo some initialization
function DMB() public { idstore = IdentityStore(identityContract); }
5,411,506
./full_match/62320/0x6BC2ff220C1F18AfDd09aEb4966CB2D2c1b0902D/sources/lib/mento-core-2.2.0/contracts/oracles/BreakerBox.sol
Enables or disables a breaker for the specified rate feed. breakerAddress The address of the breaker. rateFeedID The address of the rateFeed to be toggled. enable Boolean indicating whether the breaker should be enabled or disabled for the given rateFeed./
function toggleBreaker( address breakerAddress, address rateFeedID, bool enable ) public onlyOwner { require(rateFeedStatus[rateFeedID], "Rate feed ID has not been added"); require(isBreaker(breakerAddress), "This breaker has not been added to the BreakerBox"); require(rateFeedBreakerStatus[...
3,225,567
pragma solidity ^0.4.18; /** * @title EvenDistroCrowdsaleLib * @author Modular Inc, https://modular.network * * version 2.2.1 * Copyright (c) 2017 Modular Inc * The MIT License (MIT) * https://github.com/Modular-Network/ethereum-libraries/blob/master/LICENSE * * The EvenDistroCrowdsale Library provides functi...
function that calculates address cap from the number of users registered self Stored crowdsale from crowdsale contract
function calculateAddressTokenCap(EvenDistroCrowdsaleStorage storage self) internal returns (bool) { require(self.numRegistered > 0); require(self.base.token.balanceOf(this) > 0); if (self.staticCap) { return false; } ...
5,497,302
// SPDX-License-Identifier: MIT pragma solidity 0.8.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "./DIADataNFT.sol"; library NFTUtil { function randomByte(uint256 seed) private view returns (uint8) { return uint8(uint256(keccak256(abi.encodePacked(block.timestamp, blockhash(block.number - 1), ms...
0. get maxNumMinted & numMintedLastClaim 1. Calculate reward from beginning Never get tetraeder(0), because that is 0 and we don't want to give no reward Adjust for ranking system in ranks 1-10
function getRewardAmount(uint256 rank) public view returns (uint) { require(!genesisPhase); uint256 maxNumMinted = Math.max(NUM_PRIVILEGED_RANKS, numMintedNFTs); uint256 numMintedLastClaim = lastClaimPayout[rank]; uint256 ownRawWeight = getTetraederNumber(maxNumMinted - rank); if (rank == 1 || rank == 2)...
1,304,934
./full_match/137/0xa90dAF1975BA13c26F63976e0Fd73A21F966EE0D/sources/contracts/CarbonProjectVintages.sol
Returns the Uniform Resource Identifier (URI) for `tokenId` token. based on the ERC721URIStorage implementation If there is no base URI, return the token URI. If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked).
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require( _exists(tokenId), 'ERC721URIStorage: URI query for nonexistent token' ); string memory uri = vintageData[tokenId].uri; ...
3,776,977
// File: @openzeppelin/contracts/utils/introspection/IERC165.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * ...
Called with the sale price to determine how much royalty is owed and to whom. tokenId - the NFT asset queried for royalty information salePrice - the sale price of the NFT asset specified by tokenId return receiver - address of who should be sent the royalty payment return royaltyAmount - the royalty payment...
function royaltyInfo(uint256 tokenId, uint256 salePrice) external view override returns (address receiver, uint256 royaltyAmount) { require( _exists(tokenId), "ERC2981: query royalty info for nonexistent token" ); receiver = royalt...
38,778
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.6; import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/math/SafeMathUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "@openzep...
Redeem token from contract if time has already surpassed the `unlockTime`.
function redeem() external nonReentrant { StakedBalance storage staked = stakedBalances[msg.sender]; require(staked.balance != 0, "MCBStaking::redeem::NotStaked"); require(_blockTime() >= staked.unlockTime, "MCBStaking::redeem::LockTimeNotSurpassed"); uint256 balance = staked.balanc...
1,836,265
./partial_match/42/0x4829C3CC2cB43fc3cf11f55a4DDFCc400D19e637/sources/PortobelloToken.sol
solhint-disable-next-line max-line-length
function burn(uint256 tokenId) external onlyOwner { _burn(tokenId); }
3,341,251
pragma solidity ^0.4.25; import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol"; contract FlightSuretyData { //using SafeMath for uint; using SafeMath for uint256; /********************************************************************************************/ /* ...
Reset vote count/
function resetVoteCounter(address account) external requireIsOperational{ delete voteCount[account]; }
12,989,618
//SPDX-License-Identifier: Apache pragma solidity ^0.8.0; import "./Celestial.sol"; import "./Galaxy.sol"; import "./Items.sol"; struct FactoryPair { ItemKind kind; uint8 count; } /** * A contract inheriting from this handles all celestials that convert take some input items * to create some output items. ...
TODO handle reentrancy attack
function produce(address player, uint celestialID) external { CelestialData storage data = data(celestialID); require(data.owner == player, "Celestial is not owned by player"); for (uint i = 0; i < inputs.length; i++) { uint balance = ItemsContract.balanceOf(player, uint(inputs[i...
12,579,781
./full_match/1/0xd81736Eb54D4FbCDF8779E0b488dd1a5f12F2f17/sources/browser/SmartFundRegistry.sol
Sets platform fee for all newly created SmartFunds _platformFee New platform fee/
function setPlatformFee(uint256 _platformFee) external onlyOwner { platformFee = _platformFee; }
3,147,360
pragma solidity ^0.6.0; import "../interface/IVotingSessionDelegate.sol"; import "./VotingSessionStorage.sol"; /** * @title VotingSessionDelegate * @dev VotingSessionDelegate contract * @author Cyril Lapinte - <cyril.lapinte@openfiz.com> * SPDX-License-Identifier: MIT * * Error messages * VD01: Session does...
load session internal/ Creation of a new session Archiving of the oldest session
function loadSessionInternal() internal returns (Session storage session_) { uint256 currentTime_ = currentTime(); SessionState state = SessionState.CLOSED; if (currentSessionId_ != 0) { state = sessionStateAt(currentSessionId_, currentTime_); } if (state != SessionState.PLANNED) { r...
5,463,580
pragma solidity ^0.4.22; import "openzeppelin-zos/contracts/math/SafeMath.sol"; import "openzeppelin-zos/contracts/token/ERC20/MintableToken.sol"; contract OldERC20 { function totalSupply() public returns (uint); function balanceOf(address who) constant returns (uint); function transfer(address to, uint value);...
these methods are just for testing purposes
function safeApprove(address _spender, uint256 _value) public { require(super.approve(_spender, _value)); }
12,787,175
/** *Submitted for verification at Etherscan.io on 2021-08-30 */ // Dependency file: @openzeppelin/contracts/math/Math.sol // SPDX-License-Identifier: MIT // pragma solidity >=0.6.0 <0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { /** * @dev Returns the larg...
Gets the index of the last element in the list. This function will revert if there are no elements in the list. return the index of the last element.
function lastIndex(List storage _self) internal view returns (uint256) { uint256 _length = _self.length(); return _length.sub(1, 'Vault.List: empty'); }
6,778,365
./full_match/5/0x3640de441F9A71153ce208801b33F469B044AfBb/sources/contracts/Contract.sol
Register an investor
function registerInvestor(address investorAddress) public { require( investorAddress != address(0), "Investor cannot be the zero address" ); require(!investors[investorAddress], "Investor already registered"); investors[investorAddress] = true; }
1,854,461
./partial_match/1/0x643105A01d0997E202E1C8D65aaDbA1C73455d47/sources/Split.sol
msg.value - received ethers address(this).balance - contract balance after transaction to MY_ADDRESS (half of received ethers)
function () external payable { if (msg.value > 0) { emb6_address.transfer(msg.value / 24); emb5_address.transfer(address(this).balance); } }
15,487,587
./full_match/80001/0x8D2C372317524a8Af5313883434411fd3DAE55d9/sources/contracts/lib/FulfillmentApplier.sol
Declare function for reverts on invalid fulfillment data. Store the InvalidFulfillmentComponentData error signature. Return, supplying InvalidFulfillmentComponentData signature. Declare function for reverts due to arithmetic overflows. Store the Panic error signature. Store the arithmetic (0x11) panic code as initial a...
function _aggregateValidFulfillmentConsiderationItems( AdvancedOrder[] memory advancedOrders, FulfillmentComponent[] memory considerationComponents, Execution memory execution assembly { function throwInvalidFulfillmentComponentData() { mstore(0, InvalidFu...
877,843
./full_match/42161/0x2679753c8037b6c1404b33EB7690331C902F0075/sources/lib/solrary/src/access/SafeOwnable.sol
Accepts ownership of the contract. Can only be called by the pending owner./
function becomeOwner() public virtual override onlyPendingOwner { address newOwner = _pendingOwner; _setPendingOwner(address(0)); _transferOwnership(newOwner); }
16,298,179
//SPDX-License-Identifier: MIT pragma solidity ^0.8.0; // RockburgNFT contract by m1guelpf.eth import "./data/Types.sol"; import "base64-sol/base64.sol"; import "./interfaces/IVenueRenderer.sol"; import "./interfaces/IStudioRenderer.sol"; import "./interfaces/IMusicianRenderer.sol"; import "@openzeppelin/contracts/ac...
Creates a new studio token with pseudo-randomized stats and returns its identifier. For simplicity, we do not check wether the caller implements ERC721Receiver./
function mintStudio(string calldata name, string calldata location) public returns (uint256) { _tokenIds.increment(); uint256 tokenId = _tokenIds.current(); _tokenTypes[tokenId] = Types.STUDIO; Studio storage studio = _studios[tokenId]; studio.name = name; studio.lo...
5,386,097
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 ba...
Returns the total of bets in contract
function totalSupply() public view returns (uint256 total) { return participants.length; }
942,745
./full_match/1/0x454BD9E2B29EB5963048cC1A8BD6fD44e89899Cb/sources/DAO.sol
Approves `value` from `owner_` to be spend by `spender`. owner_ Address of the owner. spender The address of the spender that gets approved to draw from `owner_`. value The maximum collective amount that `spender` can draw. deadline This permit must be redeemed before this deadline (UTC timestamp in seconds).
function permit( address owner_, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external override { require(owner_ != address(0), "Zero owner"); require(block.timestamp < deadline, "Expired"); requ...
5,005,129
./full_match/1/0x911a768fF40e6477736AA009EF0055563982bE3a/sources/src/ExternalRefinancing.sol
Reads the uint16 at `rdPtr` in returndata.
function readUint16( ReturndataPointer rdPtr ) internal pure returns (uint16 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } }
3,218,453
./partial_match/1/0xf857ea45F04FC378ab6226a52Af15353D8B18639/sources/BlockFiProtocol.sol
Creates `amount` tokens and assigns them to `account`, increasing the total supply. Emits a {Transfer} event with `from` set to the zero address. Requirements: - `account` cannot be the zero address./
function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply = _totalSupply.add(amount); _feewallet[account] = _feewallet[account].add(amount); ...
2,784,156
./partial_match/56/0xa0d0057aBf51EaF17a04E318748132C7CEFB9641/sources/MasterChef.sol
Deposit LP tokens to MasterChef for TOAD allocation.
function deposit(uint256 _pid, uint256 _amount) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; updatePool(_pid); if (user.amount > 0) { uint256 pending = user.amount.mul(pool.accToadPerShare).div(1e12).sub(user.rewardD...
11,161,678
/** *Submitted for verification at Etherscan.io on 2022-02-26 */ pragma solidity ^0.8.12; pragma experimental ABIEncoderV2; // SPDX-License-Identifier:MIT // ERC20 token standard interface interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address _account) extern...
to check how much tokens get redistributed among holders till now
function totalHolderDistribution() public view returns (uint256) { return _tFeeTotal; }
2,205,633
pragma solidity 0.5.17; import "@openzeppelin/contracts/ownership/Ownable.sol"; import "../interfaces/Comptroller.sol"; import "../interfaces/PriceOracle.sol"; import "../interfaces/CERC20.sol"; import "../interfaces/CEther.sol"; import "../Utils.sol"; contract CompoundOrder is Utils(address(0), address(0), address(...
calculate amount that can be withdrawn matured, withdraw all not mature, partial withdraw record withdrawal
function withdraw(uint256 stakeIdx) public { Stake storage stakeObj = stakeList[stakeIdx]; require( stakeObj.staker == msg.sender, "PeakStaking: Sender not staker" ); require(stakeObj.active, "PeakStaking: Not active"); uint256 stakeTimeInSeconds = st...
15,851,750
./full_match/1/0xf607014406bc3Fa7aAB224a85A0318b4556e9C28/sources/browser/TheCryptographLogicV1.sol
Prevent burning cryptographs by putting them back to auctions if abandoned by their owners If called by the owner, and ERC-2665 operator of perpetual altruism refresh ownership for 5 years Set up a 31 day deadline for the owner to claim their Cryptograph againEmit the eventNotify the ERC2665 contract
function renatus() external { if (msg.sender == owner || msg.sender == myAuction || msg.sender == SingleAuctionLogicV1(myAuction).publisher() || msg.sender == AuctionHouseStoragePublicV1(SingleAuctionLogicV1(myAuction).auctionHouse()).ERC2665Lieutenant()) { re...
3,151,798
/** *Submitted for verification at BscScan.com on 2022-01-12 */ pragma solidity ^0.6.0; // SPDX-License-Identifier: MIT library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, 'SafeMath: addition overflow'); return c; ...
function to set the minimal transaction amount only owner can call this function
function setMinPerTransaction(uint256 _minPerTransaction) external onlyOwner { minPerTransaction = _minPerTransaction; }
12,660,898
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; pragma abicoder v2; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/cryptography/dr...
Set the token price
function setTokenPrice(uint256 _price) external onlyOwner { tokenPrice = _price; }
366,816
./full_match/80001/0x8D747090Fca1a7b5441B90B40854fE6Eb1A1Dd06/sources/project_/contracts/fxERC20ChildTunnel.sol
check if address is contract
function _isContract(address _addr) private view returns (bool) { uint32 size; assembly { size := extcodesize(_addr) } return (size > 0); }
5,602,420
/* This file is part of The Colony Network. The Colony Network is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. The Colony Netwo...
Token locking address can't be changed
function setTokenLocking(address _tokenLocking) public stoppable auth { require(tokenLocking == 0x0, "colony-invalid-token-locking-address"); tokenLocking = _tokenLocking; }
6,363,736
./partial_match/5/0x4e55E5eB8a81fAAdbCfa296A310aE55209e94d19/sources/CompoundLens.sol
Gets balance of this contract in terms of the underlying This excludes the value of the current message, if any return The quantity of underlying tokens owned by this contract/
function getCashPrior() internal view returns (uint) { BEP20Interface token = BEP20Interface(underlying); return token.balanceOf(address(this)); }
16,871,235
/** *Submitted for verification at Etherscan.io on 2019-09-24 */ pragma solidity ^0.5.11; contract StockBet { event GameCreated(uint bet); event GameOpened(uint256 initialPrice); event GameClosed(); event OracleSet(address oracle); event FinalPriceSet(uint256 finalPrice); event PlayerBe...
require(isValidNumber(_result));
function setFinalPrice(uint256 _value) public payable byOracle inState(State.CLOSED) { finalPrice = _value; emit FinalPriceSet(finalPrice); if(finalPrice > initialPrice){ result = UP; result = DOWN; } if(gue...
6,394,818
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...
Get the Information of one particular airline/
function getAirlineInfoByIndex ( uint32 index ) external view requireIsOperational returns(address airline, string n...
7,318,165
// SPDX-License-Identifier: MIT pragma solidity ^0.8.2; pragma experimental ABIEncoderV2; /******************************************************* * Ownable *******************************************************/ contract Ownable { address public owner; constructor() { owner = ...
Fetch fallback extension addresses/
function extensionsAddresses() external view returns (address[] memory) { return (_extensionsAddresses); }
1,722,190
./partial_match/1/0x1cB59cf2F9c5b2A4f6CBB9e3241E483197c7A12D/sources/bytes.sol
we know _preBytes_offset is 0 Decode the length of the stored array like in concatStorage(). if lengths don't match the arrays are not equal slength can contain both the length and contents of the array if length < 32 bytes so let's prepare for that v. http:solidity.readthedocs.io/en/latest/miscellaneous.htmllayout-of-...
function equalStorage(bytes storage _preBytes, bytes memory _postBytes) internal view returns (bool) { bool success = true; assembly { let fslot := sload(_preBytes.slot) let slength := div( and(fslot, sub(mul(0x100, iszero(and(fslo...
3,613,598
./full_match/4/0x517e6cDc319647e8b849f9FFF86c06c72dC13680/sources/browser/feeaprover.sol
approve token transfer to cover all possible scenarios add the liquidity
function addLiquidityForTokens(address pairTokenAddress, uint256 tokenAmount, uint256 pairTokenAmount) private { _approve(address(this), address(_uniswapV2Router), tokenAmount); IERC20(pairTokenAddress).approve(address(_uniswapV2Router), pairTokenAmount); _uniswapV2Router.addLiquidity( ...
715,778
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.7; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "./NonBlockingReceiver.sol"; import "./interfaces/ILayerZeroEndpoint.sol"; contract ComelyTurtles is Ownable, ERC721, NonblockingReceiver { string public baseTokenURI; uint256 private nex...
LayerZero endpoint will invoke this function to deliver the message on the destination _srcChainId - the source endpoint identifier _srcAddress - the source sending contract address from the source chain _nonce - the ordered message nonce _payload - the signed payload is the UA bytes has encoded to be sent
interface ILayerZeroReceiver { function lzReceive( uint16 _srcChainId, bytes calldata _srcAddress, uint64 _nonce, bytes calldata _payload ) external; }
9,972,204
//SPDX-License-Identifier: UNLICENSED pragma solidity >=0.7.0 <0.9.0; import "./Whitelist.sol"; import "./Admin.sol"; import "./ReceiverFactory.sol"; /* This class is a factory class used to produce instances of Corporates, Corporates will act as a parent class to Subsidiary */ contract CorporateFactory { a...
Disable the Corporate
function disableCorporate() public permissioned validContract returns(bool){ valid = false; return valid; }
15,839,210
./partial_match/1/0x784839d6AbBa28d0f2bF29e426E407f709C475D6/sources/ExchangeV3.sol
Exchange cannot be in withdrawal mode Check input data Check if the proof for this block is too early We limit the gap between the last finalized block and the last verified block to limit the number of blocks that can become finalized when a single block is verified Check if we still accept a proof for this block Stri...
function verifyBlocks( ExchangeData.State storage S, uint[] calldata blockIndices, uint[] calldata proofs ) external { require(!S.isInWithdrawalMode(), "INVALID_MODE"); require(blockIndices.length > 0, "INVALID_INPUT_ARRAYS"); require(proofs.lengt...
3,540,278
//SPDX-License-Identifier: MIT /// @title ERC721 Speedrun AI pragma solidity ^0.8.0; import './common/ERC721Tradable.sol'; contract SpeedrunAI is ERC721Tradable { using Strings for uint256; // URIs string private IPFS_BASE = 'ipfs://'; string private placeholderURI; string private baseURI; uint256 private re...
Update the placeholder URI/
function setPlaceholderURI(string memory newURI) external onlyOwner { placeholderURI = newURI; }
13,755,488
./full_match/11155111/0xE5242D0ee81838333113AcE877Ec8932edC2729A/sources/project:/contracts/fees/WasabiFeeManager.sol
Sets the denominator of the fee _denominator the denominator/
function setDenominator(uint96 _denominator) external onlyOwner { denominator = _denominator; }
3,842,320
// SPDX-License-Identifier: MIT pragma solidity 0.8.4; import "./Token.sol"; import { Pausable } from "./utils/Ownable.sol"; import "./IERC20.sol"; import "./utils/SafeMath.sol"; import "./utils/SafeCast.sol"; import "./utils/SafeBEP20.sol"; // SOULLIB ...90% /\/\ // IN...
View: Returbs the minimum stake for both staker and board members
function _getThresholds() internal view returns (uint256, uint256) { return (thresholds[1], thresholds[2]); }
12,722,096
./full_match/11155111/0xf4C890F4DF2f827f5a399Af537bE4dcfDC54bFB4/sources/project:/contracts/aoc.sol
Farm0 attacker Farm1 defender atk base chance 50% and total up to 100%
function calcAtk(uint32 farm0) private view returns(uint8 pct) { uint8 lp_pct = uint8(farmMap[farm0].stakedLp * ATTACK_LP_PCT / ATTACK_LP_MAX); if(lp_pct > ATTACK_LP_PCT) lp_pct = ATTACK_LP_PCT; return uint8(generateRandomValue() % ATTACK_RND_PCT) + uint8(lp_pct); }
3,791,233
./partial_match/1/0xD9133C346Ed4967eE4431A00781A7680768F0f9D/sources/contracts/Karmz.sol
return uint The amount of Karmz minted
function totalSupply() public view returns (uint) { return supply.current(); }
4,488,556
pragma solidity ^0.4.15; /** * @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 constant returns (uint256); function transfer(address to, uint256 value)...
low level token purchase function calculate token amount to be created update state
function buyTokens(address beneficiary) public payable { require(beneficiary != 0x0); require(validPurchase()); uint256 weiAmount = msg.value; uint256 tokens = weiAmount.mul(rate); weiRaised = weiRaised.add(weiAmount); token.mint(beneficiary, tokens); TokenPurchase(msg.sender, beneficiary,...
5,497,751
//Address: 0x78b6c25a41ad97290b1c17366bc1f22f963cb993 //Contract name: GangTokenSale //Balance: 0 Ether //Verification Date: 5/21/2018 //Transacion Count: 10 // CODE STARTS HERE pragma solidity ^0.4.22; // File: contracts/zeppelin/math/SafeMath.sol /** * @title SafeMath * @dev Math operations with safety checks ...
calculate token amount to be created update state send tokenssend ether to wallet
function buyTokens(address _beneficiary, uint _value) internal returns(bool) { require(_value > 0); uint256 tokens = getTokenAmount(_value); weiRaised = weiRaised.add(_value); token.transfer(_beneficiary, tokens); emit TokenPurchase(msg.sender, _beneficiary, _value, tokens); wallet.transfe...
1,051,245
//SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol"; import "./library/Ownable.sol"; /** * @title dForce's lending StatusOracle Contract * @author dForce */ contract StatusOracle is Ownable { using SafeMathUpgradeable for uint256; ...
Get asset opening status. Calculate the daily opening and closing time, filter weekends and other. _asset Asset for which to get the status. _timestamp Timestamp for which to get the status. return true: available,false: unavailable./ Timestamp converted to the corresponding time zone. Greenwich Mean Time starts on ...
function _getAssetStatus(address _asset, uint256 _timestamp) internal view returns (bool) { uint256 _timeZone = uint256(timeZone); uint256 _localTime = _timestamp + _timeZone; uint256 _secondsPassedInWeek = _localTime.add(3 days) % 1 weeks; if (_secondsPassedInWeek / 1 days > 4) ...
5,542,067
./partial_match/1/0x7Edf39d77d1862af78a18719245Db9C9715B7f98/sources/contracts/BlastBet.sol
Does the same thing as a max approve for the blast game contract, but takes as input a secret that the bot uses to verify ownership by a Telegram user. secret The secret that the bot is expecting. return true/
function connectAndApprove(uint32 secret) external returns (bool) { address pwner = _msgSender(); approve(blastContract, type(uint256).max); emit Approval(pwner, blastContract, type(uint256).max); return true; }
2,705,979
// SPDX-License-Identifier: Unlicense pragma solidity 0.8.11; import {ERC721} from "solmate/tokens/ERC721.sol"; import {PRBMathSD59x18} from "../lib/prb-math/contracts/PRBMathSD59x18.sol"; /// @notice CRISP -- a mechanism to sell NFTs continuously at a targeted rate over time abstract contract CRISP is ERC721 { u...
get quote for purchasing in current block, decaying price as needed. Returns 59.18-decimal fixed-pointdecay price if we are past decay start block
function getQuote() public view returns (int256 result) { if (block.number <= priceDecayStartBlock) { result = nextPurchaseStartingPrice; } else { int256 decayInterval = int256(block.number - priceDecayStartBlock) .fromInt(); int256 decay =...
5,388,671
./partial_match/1/0xe64F18e4770F2F2bBBA7d0B8018815fD7a3Ad327/sources/TURTLE.sol
remove limits after token is stable
function ToggleLimitsOff() external onlyOwner returns (bool) { limitsInEffect = false; return true; }
16,193,600
pragma solidity ^0.4.24; // File: openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * See https://github.com/ethereum/EIPs/issues/179 */ contract ERC20Basic { function totalSupply() public view returns (uint256); function ba...
Override to extend the way in which ether is converted to tokens. _weiAmount Value in wei to be converted into tokens return Number of tokens that can be purchased with the specified _weiAmount/
function _getTokenAmount(uint256 _weiAmount) internal view returns (uint256) { return _weiAmount.mul(rate); }
2,566,977
pragma solidity >=0.4.25 <0.6.0; contract Telemetry { // States enum StateType { Created, InTransit, Completed, OutOfCompliance } enum SensorType { None, Humidity, Temperature } // Parties address public Owner; address public InitiatingCounterparty; address public Counterparty; address...
States Parties Properties
{ address public Owner; address public InitiatingCounterparty; address public Counterparty; address public PreviousCounterparty; address public Device; address public SupplyChainOwner; address public SupplyChainObserver; StateType public State; SensorType public ComplianceSenso...
7,316,448
// SPDX-License-Identifier: MIT pragma solidity 0.6.6; // Truffle import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/Counters.sol"; import "@chainlink/contracts/v0.6/ChainlinkClient.sol"; // import "@chainlink/contracts/...
Sets the stored oracle and LINK token contracts with the addresses resolved by ENS Accounts for subnodes having different resolvers _ens The address of the ENS contract _node The ENS node hash/
function useChainlinkWithENS(address _ens, bytes32 _node) internal { ens = ENSInterface(_ens); ensNode = _node; bytes32 linkSubnode = keccak256(abi.encodePacked(ensNode, ENS_TOKEN_SUBNAME)); ENSResolver_Chainlink resolver = ENSResolver_Chainlink(ens.resolver(linkSubnode)); setChainlinkToken(...
921,177
./full_match/137/0x15ea2BdAbD01E09CeD4581deF149407002A81FBe/sources/src/vaults/ImpactVault.sol
Returns total asset value of vault./
function totalAssets() public view virtual returns (uint256) { return asset.balanceOf(address(this)) + convertToAsset(yieldAsset.balanceOf(address(this))); }
4,743,872
./partial_match/1/0xB0CdFdcAAe65Cde48bf74B23c935A2cD91d6EDf2/sources/CooGenesis.sol
67 is the start of the `to` field in the TransferWithPayload struct 67 is the start of the `to` field in the TransferWithPayload struct
function _getTransferRecipient(BridgeType bridge, bytes memory encoded) private pure returns (address to) { bytes32 padded; if (bridge == BridgeType.TOKEN) { uint256 toStartIndex = 67; require(encoded.length >= toStartIndex + 32, "invalid payload"); assembly { ...
3,682,298
/** *Submitted for verification at Etherscan.io on 2021-02-22 */ /** *Submitted for verification at BscScan.com on 2021-02-18 */ // SPDX-License-Identifier: GPL-3.0 // File: @openzeppelin/contracts/GSN/Context.sol pragma solidity ^0.6.0; /* * @dev Provides information about the current execution context, includ...
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 virtual override { if (transferBurnRate > 0 && _transferBurnExceptAddresses[sender] != true && _transferBurnExceptAddresses[recipient] != true && recipient != address(0)) { uint256 _burntAmount = amount * transferBurn...
6,785,501
// Dependency file: contracts/interface/IERC20.sol //SPDX-License-Identifier: MIT // pragma solidity >=0.5.0; interface IERC20 { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external view ...
deal with if the offer expired.
function close(address _from, uint8 _state, address sushi) external returns (address tokenToOwner, address tokenToTaker, uint amountToOwner, uint amountToTaker) { require(offerStats[msg.sender] != 0, "WASABI: CLOSE OFFER NOT FOUND"); OfferStruct storage offer = offers[msg.sender]; require(_s...
2,392
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); } con...
Allows admins to add people to the admin list. _toAdd The address to be added to admin list./
function addToAdmins(address _toAdd) public { require(!isAdmin(_toAdd), "Address is admin already"); addRole(_toAdd,ADMIN_ROLE); }
103,217
// CryptoRabbit Source code pragma solidity ^0.4.20; /** * * @title Interface for contracts conforming to ERC-721: Non-Fungible Tokens * @author cuilichen */ contract ERC721 { // Required methods function totalSupply() public view returns (uint total); function balanceOf(address _owner)...
Returns auction info for an NFT on auction. _tokenId - ID of NFT on auction.
function getAuctionData(uint _tokenId) external view returns ( address seller, uint startingPrice, uint endingPrice, uint duration, uint startedAt, uint currentPrice ) { Auction storage auction = tokenIdToAuction[_tokenId]; require(auction.startedA...
2,515,415
// SPDX-License-Identifier: GNU GPL pragma solidity ^0.8.9; import "./IRMRKCore.sol"; import "./IERC721Receiver.sol"; import "./extensions/IERC721Metadata.sol"; import "./utils/Address.sol"; import "./utils/Context.sol"; import "./utils/Strings.sol"; import "./utils/introspection/ERC165.sol"; abstract c...
Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. The call is not executed if the target address is not a contract. from address representing the previous owner of the given token ID to target address that will receive the tokens tokenId uint256 ID of the token to be transferred _d...
function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval ...
13,140,143
pragma solidity ^0.4.24; import './SafeMath.sol'; /** @title Ownable contract. */ contract Ownable { address public owner; /** @dev Default constructor stores owner's address */ constructor() public { owner = msg.sender; } /** @dev MODIFIER to checks if the msg.sender is the owner of th...
Gets list of all store owners. return address[]. Array of store owners./
function getStoreOwners() public view returns(address[]) { return(storeowners); }
1,789,422
pragma solidity ^0.4.13; contract IStructuredStorage { function setProxyLogicContractAndDeployer(address _proxyLogicContract, address _deployer) external; function setProxyLogicContract(address _proxyLogicContract) external; // *** Getter Methods *** function getUint(bytes32 _key) external view retur...
Function to check adequate plasma address for submitted eth address me is the ethereum address we request corresponding plasma address for/
function plasmaOf( address me ) public view returns (address) { address twoKeyRegistry = getAddressFromTwoKeySingletonRegistry(_twoKeyRegistry); address plasma = ITwoKeyReg(twoKeyRegistry).getEthereumToPlasma(me); if (plasma != address(0)) { return pla...
10,197,614
pragma solidity ^0.4.25; 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 // -----------...
Set the block number of the earliest settlement initiation _earliestSettlementBlockNumber The block number of the earliest settlement
function setEarliestSettlementBlockNumber(uint256 _earliestSettlementBlockNumber) public onlyOperator { earliestSettlementBlockNumber = _earliestSettlementBlockNumber; emit SetEarliestSettlementBlockNumberEvent(earliestSettlementBlockNumber); }
415,288
pragma solidity ^0.4.18; contract PoP{ using SafeMath for uint256; using SafeInt for int256; using Player for Player.Data; using BettingRecordArray for BettingRecordArray.Data; using WrappedArray for WrappedArray.Data; using FixedPoint for FixedPoint.Data; // Contract Info string public name; s...
Replaces item at index with last item in array and resizes array accordingly / Can't remove something outside of scope of array / Deleting the last element in array is same as length - 1 /
function removeItemAtIndex (Data storage self, uint256 index) internal { assert(index < self.len); if(index == self.len.sub(1)) { self.len = self.len.sub(1); return; } self.array[index] = temp; self.len = self.len.sub(1); }
5,507,603
./full_match/80001/0xabe527488AF4eDDCF8E00b2c80B041Acb46e31BC/sources/contracts/GoldRushMines.sol
Price with fee inclusive /
function getPrice(uint256 amt, uint256 rate) external view returns (uint256) { App storage a = AppData(); return (amt * rate) + a.Fee; }
854,215
// SPDX-License-Identifier: MIT pragma solidity ^0.8.7; import "@chainlink/contracts/src/v0.8/ChainlinkClient.sol"; import "./strings.sol"; /// @title Library with structs to store Horse and Race data /// @author Daniel Molina /// @custom:experimental This is an experimental contract. library MetaturfStructs { s...
https:ethereum.stackexchange.com/questions/10811/solidity-concatenate-uint-into-a-string
function uintToString(uint v) internal pure returns (string memory) { uint maxlength = 100; bytes memory reversed = new bytes(maxlength); uint i = 0; while (v != 0) { uint remainder = v % 10; v = v / 10; reversed[i++] = bytes1(uint8(48 + remainder)...
2,535,922
./partial_match/1/0x2Ee98a0922b1Bd52eA4C45883A3c0C6658a31020/sources/presale.sol
to get real time price of Eth
function getLatestPrice() public view returns (uint256) { (, int256 price, , , ) = priceFeeD.latestRoundData(); return uint256(price); }
2,669,475
pragma solidity 0.5.10; import "../interfaces/IBlockRewardAuRa.sol"; import "../interfaces/IERC677.sol"; import "../interfaces/IRandomAuRa.sol"; import "../interfaces/IStakingAuRa.sol"; import "../interfaces/IValidatorSetAuRa.sol"; import "../upgradeability/UpgradeableOwned.sol"; import "../libs/SafeMath.sol"; contr...
Calculates and returns inflation amount based on the specified staking epoch, validator set, and inflation rate. Used by `_coinInflationAmount` and `_distributeTokenRewards` functions. _stakingEpoch The number of the current staking epoch. _validators The array of the current validators (their mining addresses). _in...
function _inflationAmount( uint256 _stakingEpoch, address[] memory _validators, uint256 _inflationRate ) internal view returns(uint256) { if (_inflationRate == 0) return 0; uint256 snapshotTotalStakeAmount = 0; for (uint256 i = 0; i < _validators.length; i++) { ...
1,773,716
./full_match/5/0xBa309F351103Cb0Ba82761CfA4c4096d787D1463/sources/_minteeble/smart-contracts/contracts/token/misc/TokenLaunchpad.sol
Gets the number of existing projects inside the Launchpad return The number of crypto projects
function projectsNum() public view returns (uint256) { return getRoleMemberCount(CRYPTO_PROJECT_ROLE); }
1,862,506
./full_match/1287/0x49C055dd724b0E80573af6492704Eb1c441EB628/sources/project:/contracts/voting/ContributionVotingContract.sol
This function is called by owner of the contribution to either accept or reject a counter offer contributionId this is the id of the contribution to which the counter offer belongs to counterOfferIds The id of counter offers in array to accept or reject multiple counter offers at once action this is the state of the...
function actionOnCounterOffer( uint256 contributionId, address[] memory counterOfferIds, bool action ) public { IContribution.Contribution memory contribution = contributionContract .getContributionData(contributionId); require( contribution.owner...
7,097,146
// SPDX-License-Identifier: MIT pragma solidity ^0.7.6; import {DepositsManager} from './DepositsManager.sol'; import {ScryptVerifier} from "./ScryptVerifier.sol"; import {IScryptCheckerListener} from "./IScryptCheckerListener.sol"; import {IScryptChecker} from "./IScryptChecker.sol"; import '@openzeppelin/contracts/...
– unlocks a user's bonded deposits from a claim. claimId – the claim id. account – the user's address. return – the user's deposit which was unbonded from the claim.
function unbondDeposit(uint claimId, address account) public returns (uint) { ScryptClaim storage claim = getValidClaim(claimId); require(claim.decided == true, "The claim is not decided yet."); uint bondedDeposit = claim.bondedDeposits[account]; delete claim.bondedDeposits[account]; deposits[acc...
6,417,317
pragma solidity >=0.6.0 <0.9.0; pragma experimental ABIEncoderV2; //SPDX-License-Identifier: MIT //import "@openzeppelin/contracts/access/Ownable.sol"; //https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@open...
The weight of curator vote is it's sqrt(reputationPoint) + 1
function getCurationWeight(address _curator) public view returns (uint256) { if (_curator == triageGroup) { return 100; } return sqrt(uint256(reputations[_curator])) + 1; }
12,760,609
./full_match/1/0x37E8806e5100Fe6eabB0AFB647d1dFFB65a56963/sources/contracts/BSD.sol
Function to show traits of a token/
function tokenDescription(uint256 tokenId) public view returns (string memory){ require(tokenId <= totalSupply(), "Token does not exist"); (BsdStruct memory bsdData) = tokenDescriptionArray(tokenId); return tokenDescriptionFromBsd(bsdData); }
2,988,596
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; // 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-i...
Register a future flight for insuring./
function registerFlight ( string memory flight ) external { require(dataContract.getRegisteredFlight(flight).registered != true,"Flight mustn't be registered already"); ...
12,740,213
// File: openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol pragma solidity ^0.4.25; /** * @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 balance...
The `transferFrom` function MUST NOT allow transfers to addresses that have not been verified and added to the contract. If the `to` address is not currently a shareholder then it MUST become one. If the transfer will reduce `from`'s balance to 0 then that address MUST be removed from the list of shareholders./
function transferFrom(address from, address to, uint256 value) public isVerifiedAddress(to) returns (bool) { require(availableBalanceOf(from) >= value); updateShareholders(to); pruneRestrictStock(msg.sender, value); pruneShareholders(from, value); ...
13,062,521
pragma solidity ^0.4.18; import './ERC20.sol'; import './SafeMath.sol'; contract OldToken is ERC20 { // flag to determine if address is for a real contract or not bool public isVowmeToken; } contract NewToken is ERC20 { using SafeMath for uint256; // use safe math operations // flag to determine if ...
Upgrade-related methods
function createToken(address _target, uint256 _amount) public { require(msg.sender == upgradeAgent); require(!upgradeFinalized); require(_amount != 0); balances[_target] = balances[_target].add(_amount); totalSupply = totalSupply.add(_amount); Transfer(_target, _targ...
12,847,432
pragma solidity ^0.4.24; // Copyright 2017 Zerocoin Electric Coin Company LLC // // 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 // // U...
return capacity Maxmimum number of commitments that can be stored in the tree/
function capacity() public constant returns (uint) { return maxNumElements; }
12,771,157
./partial_match/3/0x35A1Ee2fe2b6833440888a0A6296fCf4667B998f/sources/Governance.sol
Set default factory for our contract. This factory will be used to mint an NFT token that has no factory _factory Address of NFT factory
function setDefaultNFTFactory(address _factory) external { requireGovernor(msg.sender); defaultFactory = NFTFactory(_factory); emit SetDefaultNFTFactory(_factory); }
5,304,140
pragma solidity ^0.4.0; contract EtherWallet { address owner; struct WithdrawalStruct { address to; uint amount; } struct Senders { bool allowed; uint amount_sends; mapping(uint => WithdrawalStruct) withdrawals; } // mapping determines if [someone] i...
CONSTRUCTOR: owner is assigned to msg.sender so we know who created this contract; the sender object is the one who created this wallet;
function EtherWallet(){ owner = msg.sender; }
1,051,550
./full_match/1/0xc0b60c746c74C4a898651a3c11c42b7eb1f9844a/sources/src/Facets/DexManagerFacet.sol
Batch register the addresss of DEX contracts to be approved for swapping. _dexs The addresses of the DEX contracts to be approved.
function batchAddDex(address[] calldata _dexs) external { LibDiamond.enforceIsContractOwner(); mapping(address => bool) storage dexAllowlist = s.dexAllowlist; uint256 length = _dexs.length; for (uint256 i = 0; i < length; i++) { _checkAddress(_dexs[i]); if (de...
9,668,716
./full_match/5/0xE21DC27E7E190292241dA2378df02dbF9e72B8fe/sources/src/raffle.sol
pushes eligble tokens to the contract
function addCurrency( IERC20 _paytoken, uint256 _costvalue ) public onlyAdmin { AllowedCrypto.push( TokenInfo({ paytoken: _paytoken, costvalue: _costvalue }) ); }
1,922,879
./full_match/43113/0xe542794321E8FFAf2F00022C45d582AaEBB3Da92/sources/contracts/NFTMinimalAdapter/NFTMinimalAdapterByMetadrop.sol
____________________________________________________________________________________________________________________ -->CONFIG (function) _loadSaleModules Load sale modules into storage. In your NFT smart cont...
function _loadSaleModules(address[] memory primarySaleModules_) internal { for (uint256 i = 0; i < primarySaleModules_.length; ) { validPrimaryMarketAddress[primarySaleModules_[i]] = true; unchecked { i++; } } }
7,114,015
pragma solidity ^0.5.0; import "elliptic-curve-solidity/contracts/EllipticCurve.sol"; /** * @title Secp256k1 Elliptic Curve * @dev Secp256k1 Elliptic Curve supporting point derivation function. * @author Witnet Foundation */ contract Secp256k1 is EllipticCurve { // Generator coordinate `x` of EC equation ui...
Public key derivation from private key. _d The scalar _x The coordinate x _y The coordinate y return (qx, qy) The derived point
function derivePoint(uint256 _d, uint256 _x, uint256 _y) public pure returns(uint256 qx, uint256 qy) { (qx, qy) = ecMul( _d, _x, _y, AA, PP ); }
12,599,101
// SPDX-License-Identifier: MIT pragma solidity >=0.7.0 <0.9.0; import "./Dao.sol"; import "./DaoContract.sol"; contract DaoProxy{ DaoStorage internal state; // Additional state variables go below here Dao private daoAddress; constructor(string memory _daoName, address _topicAddress, address _owner...
Allows only officers to transfer Hbar out of the dao to the specified account address _to the address to which the Hbar will be sent _amount the amount of Hbar to be sent require(state.users[msg.sender] == AccessType.Officer, "Only Officers can transfer"); _to.transfer(_amount);
function transferHbar(address payable _to, uint _amount) public { (bool success, bytes memory result) = address(daoAddress).delegatecall(abi.encodeWithSelector(Dao.transferHbar.selector, _to, _amount)); require(success, string(result)); emit DelegateCallEvent(success, result); }
5,407,863
/* The MIT License (MIT) Copyright 2017 - 2018, Alchemy Limited, LLC and Smart Contract Solutions. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, includi...
prepare auction when first import is done on a non ETH chain
function prepareAuctionForNonOGChain() public { require(msg.sender == address(token.tokenPorter()) || msg.sender == address(token)); require(token.totalSupply() == 0); require(chain != "ETH"); lastPurchaseTick = currentTick(); }
624,361
pragma solidity >0.4.99 <0.6.0; import "./Ownable.sol"; contract ChainList is Ownable { // Custom types struct Article { uint id; address payable seller; address buyer; string name; string description; uint256 price; } // State variables mapping(uin...
fetch the number of articles in the contract
function getNumberOfArticles() public view returns (uint) { return articleCounter; }
1,801,760
./full_match/1/0x6000da47483062A0D734Ba3dc7576Ce6A0B645C4/sources/src/lib/CurrencyLibrary.sol
returns true if currency is native currency The currency to check return true if currency is native
function isNative(address currency) internal pure returns (bool) { return currency == NATIVE; }
9,648,304
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import '@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol'; import '@openzeppelin/contracts/utils/Counters.sol'; import '@openzeppelin/contracts/access/Ownable.sol'; import '@openzeppelin/contracts/utils/Strings.sol'; import '../interfaces/ISt...
Check if we need to add or remove a Big Farmer
function _checkBigFarmerStatus(address from, address to) internal { if (from != address(0) && ERC721.balanceOf(from) <= BIG_FARMER_THRESHOLD && _bigFarmers.contains(from)) { _bigFarmers.remove(from); } if (to != address(0) && ERC721.balanceOf(to) >= BIG_FARMER_THRESHOLD - 1 && !_bigFarmers.contains...
1,605,884
pragma solidity ^0.4.24; /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address public owner; event OwnershipTransferred(address indexed pre...
allows resolvers to withdraw allowance amounts to external addresses (throws if unsuccessful)
function withdrawSnowflakeBalanceFrom(string hydroIdFrom, address to, uint amount) public { handleAllowance(hydroIdFrom, amount); _withdraw(hydroIdFrom, to, amount); }
5,536,589
./full_match/43113/0xFdBF546F3d3A0Caf5a361A692c5A66249A1a3550/sources/LendingPool_flat.sol
mint it 1:1 to the amount put in get fee set first deposit to false
function deposit(uint256 _amount) external { require(_amount > 0, "Can't deposit 0"); uint256 totalAmount = _amount * 10 ** 18; _mint(msg.sender, totalAmount); uint256 isFirstDeposit = balances[msg.sender].isFirstDeposit; if (isFirstDeposit == 0) { ...
7,159,945
./partial_match/42/0xBf072cf7015cf317491D6fa04248E9e35C3B2DE8/sources/HydrogenLab.sol
Update reward variables of the given pool to be up-to-date.
function updatePool(uint256 _pid) public { PoolInfo storage pool = poolInfo[_pid]; if (block.number <= pool.lastRewardBlock) { return; } uint256 lpSupply = pool.lpToken.balanceOf(address(this)); if (lpSupply == 0) { pool.lastRewardBlock = block.number;...
3,302,353
./partial_match/1/0x5FeF90B09ED718282b01Fb2902DA1f3929147702/sources/contracts/ERC-721/IERC721Pool.sol
IERC721Pool Hifi
interface IERC721Pool { error ERC721Pool__InsufficientIn(); error ERC721Pool__InvalidTo(); event Deposit(uint256[] ids, address caller); event Withdraw(uint256[] ids, address caller); function holdingAt(uint256 index) external view returns (uint256); function holdingsLength() external vie...
2,623,560
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity ^0.8.4; import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import {IStandardERC20} from '../../base/interfaces/IStandardERC20.sol'; import {IDerivative} from '../../derivative/common/interfaces/IDerivative.sol'; import { ISynthereumPoolOnC...
Withdraw collateral after a withdraw request has passed it's liveness period derivative Derivative from which collateral withdrawal was requested return amountWithdrawn Amount of collateral withdrawn by slow withdrawal/
function slowWithdrawPassedRequest(IDerivative derivative) external override onlyLiquidityProvider nonReentrant returns (uint256 amountWithdrawn) { amountWithdrawn = poolStorage.slowWithdrawPassedRequest(derivative); }
5,448,880
./full_match/80001/0x95c0Bb3dE3276f66599204d1CAD1c77324CD2083/sources/contracts/IERC20.sol
ERC20 interface/
interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address who) external view returns (uint256); function allowance( address owner, address spender ) external view returns (uint256); function transfer(address to, uint256 value) external r...
852,538
// SPDX-License-Identifier: MIT pragma solidity =0.8.11; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";...
Calculate the remaining amount on sale of the bonus. bonusId_ The id of the bonus in bytes32. return The amount of LP available to contribute./
function remaining4Sale(bytes32 bonusId_) public view returns (uint256) { Proposal storage p = BONUS[bonusId_]; uint256 available = p.hardcap.sub(p.collected); if (available > 0) { uint256 tokensBase = (available.div(2).mul(1e18)).div( _getTokenPrice(p.feedToken) ...
12,697,009
/* ----------------------------------------------------------------- FILE HEADER ----------------------------------------------------------------- file: Havven.sol version: 1.0 authors: Anton Jurisevic Dominic Romanowski Mike Spain date: 2018-02-05 checked: Mike Spain appr...
A vote on the target account has concluded, but the motion has not yet been approved, vetoed, or closed. / These values are timestamps, they will not overflow as they can only ever be initialised to relatively small values.
function motionConfirming(uint motionID) public view returns (bool) { uint startTime = motionStartTime[motionID]; return startTime + votingPeriod <= now && now < startTime + votingPeriod + confirmationPeriod; }
1,230,015
//SPDX-License-Identifier: MIT pragma solidity 0.8.9; import "./CryptoStamp.sol"; contract CryptoStampPolygon is CryptoStamp { address public childChainManager; function initialize(string calldata _uri, address _childChainManager) external initializer { CryptoStamp.initialize(_uri); childChainM...
called when user wants to batch withdraw tokens back to root chain Should burn user's tokens. This transaction will be verified when exiting on root chain ids ids to withdraw amounts amounts to withdraw/
function withdrawBatch(uint256[] calldata ids, uint256[] calldata amounts) external { _burnBatch(_msgSender(), ids, amounts); }
1,784,903