file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
./partial_match/1/0x1D72D4746647B7Fe84e2bCDEfD96C119FB9CB0f0/sources/DeltaTimeInventory.sol
Internal function to convert id to full uri string id uint256 ID to convert return string URI convert from given ID/
function _fullUriFromId(uint256 id) private view returns(string memory) { return string(abi.encodePacked(abi.encodePacked(_uriPrefix, Bytes.uint2str(id)))); }
4,462,486
./partial_match/42/0x558363a2535fe2d315A655EB27532671a54A7cb7/sources/CollateralManager.sol
Remove it from the the address set lib. remove the inverse mapping.
function removeShortablePynths(bytes32[] calldata Pynths) external onlyOwner { for (uint i = 0; i < Pynths.length; i++) { if (_shortablePynths.contains(Pynths[i])) { _shortablePynths.remove(Pynths[i]); bytes32 PynthKey = _Pynth(Pynths[i]).currencyKey(); ...
3,402,091
./partial_match/4/0x9619864B184FBbC4CF25FC0C75d8Dd88285Cd100/sources/FeePool.sol
If the period being checked is uninitialised then return 0. This is only at the start of the system. internal function will check closingDebtIndex has corresponding debtLedger entry
function effectiveDebtRatioForPeriod(address account, uint256 period) external view returns (uint256) { require(period != 0, "Current period is not closed yet"); require(period < FEE_PERIOD_LENGTH, "Exceeds the FEE_PERIOD_LENGTH"); if (_recentFeePeriodsStorage(pe...
8,560,066
./partial_match/1/0xF7Eb8906D91a206D6E64575D3425AC558744d0D5/sources/WstUSDT.sol
Get amount of wstUSDT for a given amount of stUSDT stUSDTAmount amount of stUSDT return Amount of wstUSDT for a given stUSDT amount/
function getWstUSDTByStUSDT(uint256 stUSDTAmount) external view returns (uint256) { return stUSDT.getSharesByUnderlying(stUSDTAmount); }
9,388,581
./full_match/11155111/0x16000f6aE37aCa9900B2136a66f032Aa2a9C5b4F/sources/contracts/CrowdFunding.sol
gives the list of donators
function getDonators(uint256 _id) view public returns (address[] memory, uint256[] memory) { return(campaigns[_id].donators, campaigns[_id].donations); }
3,811,017
./full_match/5/0x975Ce475Dfd8Bf708D6154397EE71aaecB706695/sources/BankNegara.sol
only account owners. i think admin should be able to depo and withd (my opinion)
function withdraw(uint256 amount) public onlyAccountOwners{ currentuser = msg.sender; require(amount <= balanceOf[currentuser]); balanceOf[currentuser] -= amount; payable(msg.sender).transfer(amount); bankBalance -= amount; listofwithdrawers.push(currentuser); }
1,855,680
pragma solidity 0.8.9; contract FlightSuretyData { /********************************************************************************************/ /* DATA VARIABLES */ /*****************************************************************...
Check if the passenger is registerd for the flight/
function isInsured( address passenger, address airline, string calldata flight, uint256 timestamp ) external view returns (bool) { Insurance[] memory insuredPassengers = passengersWithInsurancePerFlight[ getFlightKey(airline, flight, timestamp) ]; ...
12,800,612
./full_match/1/0x4Ed94F8AdfCA978e8f8eAa569b8f6D0DBA214663/sources/src/EtherGardenManager.sol
assume the subdomain is correctly normalized etc pls don't break my contract (:
function mintNewSubDomain(string memory newSub) external requireOpen { address newOwner = msg.sender; bytes32 subNodeLabel = keccak256(abi.encodePacked(newSub)); bytes32 subNodeFull = computeNamehash(newSub); _ens.setSubnodeRecord(BASE_HASH, subNodeLabel, address(this), address(_reso...
16,455,744
pragma solidity ^0.5.0; // lvl 2: tiered split contract TieredProfitSplitter { address payable employee_one; // ceo address payable employee_two; // cto address payable employee_three; // bob constructor(address payable _one, address payable _two, address payable _three) public { employee_one ...
Should always return 0! Use this to test your `deposit` function's logic
function balance() public view returns(uint) { return address(this).balance; }
905,806
// to test issue with nodes breaking with large clients over WS // fixed in web3 with fragmentationThreshold: 8192 pragma solidity ^0.4.17; contract BigFreakingContract { event Transfer(address indexed from, address indexed to, uint value); event Approval( address indexed owner, address indexed spender, uint valu...
TODO: should increase instead
function approve_14(address spender, uint value) public returns (bool ok) { _approvals[msg.sender][spender] = value; emit Approval( msg.sender, spender, value ); return true; }
6,453,727
// SPDX-License-Identifier: MIT pragma solidity ^0.8.11; // This is only kept for backward compatability / upgrading import {OwnableUpgradeable} from "../oz/access/OwnableUpgradeable.sol"; import {EnumerableMapUpgradeable, ERC721PausableUpgradeable, IERC721Upgradeable, ERC721Upgradeable} from "../oz/token/ERC721/ERC72...
Returns an `Uint256Slot` with member `value` located at `slot`./
function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) { assembly { r.slot := slot } }
143,769
pragma solidity ^0.5.13; import "@daostack/infra/contracts/votingMachines/IntVoteInterface.sol"; import "@daostack/infra/contracts/votingMachines/VotingMachineCallbacksInterface.sol"; import "../votingMachines/VotingMachineCallbacks.sol"; import "../libs/SafeERC20.sol"; /** * @title A scheme for proposing and rewar...
RedeemEther reward for proposal _proposalId the ID of the voting in the voting machine return amount ether redeemed amount/
function redeemEther(bytes32 _proposalId) public returns(uint256 amount) { ContributionProposal storage proposal = organizationProposals[_proposalId]; require(proposal.acceptedByVotingMachine, "proposal was not accepted by the voting machine"); if (proposal.beneficiary == address(this)) { ...
5,370,293
// SPDX-License-Identifier: MIT // File: @openzeppelin/contracts/utils/Context.sol pragma solidity >=0.6.0 <0.8.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they sh...
Returns the license for tokens
function tokenLicense(uint _id) public view returns(string memory) { require(_id < totalSupply(), "CHOOSE A BANANA WITHIN RANGE"); return LICENSE_TEXT; }
625,553
./full_match/5/0x6428f0FB2e4CFBe4e625f2eC0e20e614a6c3Ab05/sources/erc721psi/contracts/ERC721PsiUpgradeable.sol
Mapping from token ID to owner address
ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable, IERC721EnumerableUpgradeable { using AddressUpgradeable for address; using StringsUpgradeable for uint256; using BitMaps for BitMaps.BitMap; BitMaps.BitMap private _batchHead; string private _name; string private _symb...
11,606,788
./full_match/80001/0x5943F705aBb6834Cad767e6E4bB258Bc48D9C947/sources/project_/contracts/superfluid/PoolMemberNFT.sol
Destroys token with `tokenId` and clears approvals from previous owner. `tokenId` must exist AND we emit a {Transfer} event tokenId the id of the token we are destroying
function _burn(uint256 tokenId) internal override { PoolMemberNFTData storage data = _poolMemberDataByTokenId[tokenId]; if (ISuperfluidPool(data.pool).getUnits(data.member) > 0) { revert POOL_MEMBER_NFT_HAS_UNITS(); } address owner = _ownerOf(tokenId); super._bu...
5,674,599
pragma solidity ^0.4.24; contract Owned { address public owner; address public newOwner; event OwnershipTransferred(address indexed _from, address indexed _to); constructor() public { owner = msg.sender; } modifier onlyOwner { require(msg.sender == owner); _; } ...
require(now >= updateTime + 7 days);
function reSet() onlyOwner public { withdraw(1); withdraw(2); withdraw(3); card1.price = 1e18; card2.price = 1e18; card3.price = 1e18; card1.owner = owner; card2.owner = owner; card3.owner = owner; card1.payou...
10,694,196
// SPDX-License-Identifier: AGPL-3.0-only /* Nodes.sol - SKALE Manager Copyright (C) 2018-Present SKALE Labs @author Artem Payvin @author Dmytro Stebaiev @author Vadim Yavorsky SKALE Manager is free software: you can redistribute it and/or modify it under the terms of the GNU Affero Genera...
Returns the Validator ID for a given node./
function getValidatorId(uint nodeIndex) public view override checkNodeExists(nodeIndex) returns (uint) { return nodes[nodeIndex].validatorId; }
9,841,020
./full_match/5/0xeE3b38b5F9e6a4e8573b35b17705728F69B7088E/sources/project:/contracts/ForecastMarket.sol
A function where the manager changes the state of the market to adjourn /
function adjournMarket(uint256 marketKey) external onlyOwner returns (bool) { _setAdjournMarket(marketKey); emit AdjournMarket(marketKey); return true; }
1,905,085
pragma solidity ^0.6.0; // --------------------------------------------- contract AddrChecker { /// #if_succeeds {:msg "P1"} addr != address(0xAaaaAaAAaaaAAaAAaAaaaaAAAAAaAaaaAaAaaAA0); function checkAddr(address addr) external { require(addr != address(0xAaaaAaAAaaaAAaAAaAaaaaAAAAAaAaaaAaAaaAA0)); ...
if_succeeds {:msg "F"} a[arg] == 0;
function main(string memory arg) public {}
14,053,334
./partial_match/4/0x2768E24672b6EE867f63c021d9149be1f789B870/sources/AFIToken.sol
Dynamic allocate all the pool across different lending protocols if needed NOTE: this method can be paused return : whether has rebalanced or not/ check if we need to rebalance by looking at the last allocations submitted by rebalancer set in storage mint the difference if some protocol has liquidity that we should red...
function _rebalance() internal whenNotPaused returns (bool) { uint256[] memory rebalancerLastAllocations = lastRebalancerAllocations; bool areAllocationsEqual = rebalancerLastAllocations.length == lastAllocations.length; if (areAllocationsEqual) { for (uint256 i = 0; i < lastAllocati...
8,569,610
// SPDX-License-Identifier: SEE LICENSE IN LICENSE pragma solidity 0.6.12; import "./INetworkSettings.sol"; import "./utility/Owned.sol"; import "./utility/Utils.sol"; /** * @dev This contract maintains the network settings. */ contract NetworkSettings is INetworkSettings, Owned, Utils { ITokenHolder private _...
sets the network fee (in units of PPM) Requirements: - the caller must be the owner of the contract/
function setNetworkFee(uint32 newNetworkFee) external ownerOnly validFee(newNetworkFee) { emit NetworkFeeUpdated(_networkFee, newNetworkFee); _networkFee = newNetworkFee; }
2,542,431
pragma solidity ^0.6.0; pragma experimental ABIEncoderV2; import "../../common/implementation/FixedPoint.sol"; // Simple contract used to withdraw liquidations using a DSProxy from legacy contracts (1.2.2 and below). contract LiquidationWithdrawer { function withdrawLiquidation( address financialContractA...
Storing an initial non-zero value makes deployment a bit more expensive, but in exchange the refund on every call to nonReentrant will be lower in amount. Since refunds are capped to a percetange of the total transaction's gas, it is best to keep them low in cases like this one, to increase the likelihood of the full r...
function requestPrice( bytes32 identifier, uint256 timestamp, bytes memory ancillaryData, IERC20 currency, uint256 reward ) external virtual returns (uint256 totalBond); function setBond( bytes32 identifier, uint256 timestamp, bytes memory anc...
99,382
// SPDX-License-Identifier: MIT pragma solidity >=0.8; import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/proxy/Clones.sol"; import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; import "@openzeppelin/contracts/utils...
update the pool's stats update the stakeholder's stats
function unstakeShapeshifters(address stakeholder, uint256[6] calldata shapeTypes) external onlyFromAllowedOrigin { totalStaked -= shapeTypes[5]; stakes[stakeholder].unclaimed += (TWAP - stakes[stakeholder].TWAP) * stakes[stakeholder].totalStaked; stakes[stakeholder].totalStaked -= shapeTypes[5]; stakes[stake...
5,761,702
pragma solidity ^0.4.23; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint2...
it will check amount of token delegated to spender by owner owner the address which allows someone to spend fund on his behalf spender address which is delegated return return uint256 amount of tokens left with delegator/
function allowance(address owner, address spender) public view returns (uint256) { return allowed[owner][spender]; }
279,805
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; import './SafeMath.sol'; import './Address.sol'; import './IERC20.sol'; import './SafeERC20.sol'; contract ProfitSharingRewardPool { using SafeMath for uint256; using SafeERC20 for IERC20; uint256 public constant BLOCKS_PER_DAY = 28800; // g...
Safe reward transfer, just in case if rounding error causes pool to not have enough reward amount
function getReward(address _rewardToken, address _account) public { updateReward(_rewardToken); UserInfo storage user = userInfo[_account]; RewardPoolInfo storage rewardPool = rewardPoolInfo[_rewardToken]; uint256 _accRewardPerShare = rewardPool.accRewardPerShare; uint256 _pe...
12,570,658
// SPDX-License-Identifier: MIT pragma solidity 0.7.6; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dea...
Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}./
function upgradeToAndCall(address newImplementation, bytes calldata data) external payable virtual ifAdmin { _upgradeTo(newImplementation); Address.functionDelegateCall(newImplementation, data); }
18,590
pragma solidity 0.4.24; library Bytes { // Size of a word, in bytes. uint internal constant WORD_SIZE = 32; // Size of the header of a 'bytes' array. uint internal constant BYTES_HEADER_SIZE = 32; // Address of the free memory pointer. uint internal constant FREE_MEM_PTR = 0x40; /// @dev ...
Converts uint to bytes. _val uint value.
function uintToBytes(uint256 _val) internal pure returns (bytes bts) { bts = new bytes(32); }
921,749
pragma solidity ^0.4.24; // Code from Open Zeppelin import "./Ownable.sol"; import "./SafeMath.sol"; import "./ERC20.sol"; import "./DetailedERC20.sol"; import "./StandardToken.sol"; import "./MintableToken.sol"; /** * @title Capped token * @dev Mintable token with a token cap. */ contract CappedToken is MintableTo...
Function to mint tokens _to The address that will receive the minted tokens. _amount The amount of tokens to mint. return A boolean that indicates if the operation was successful./
function mint( address _to, uint256 _amount ) public returns (bool) { require(totalSupply_.add(_amount) <= cap); return super.mint(_to, _amount); }
1,013,593
/** *Submitted for verification at Etherscan.io on 2022-02-28 */ // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (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 ...
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 returns (bool) { address owner = _msgSender(); uint256 currentAllowance = _allowances[owner][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { ...
2,345,351
// SPDX-License-Identifier: MIT pragma solidity >=0.7.6 <0.8.0; import {IERC20Receiver} from "@animoca/ethereum-contracts-assets/contracts/token/ERC20/interfaces/IERC20Receiver.sol"; import {IERC20Burnable} from "@animoca/ethereum-contracts-assets/contracts/token/ERC20/interfaces/IERC20Burnable.sol"; import {IERC20Mi...
On safe reception of shards, converts them into catalysts based on the current conversion rate. Reverts if the sender is not the shards contract. Reverts if the conversion rate is currently set to zero. @inheritdoc IERC20Receiver/
function onERC20Received( address, /*sender,*/ address from, uint256 value, bytes memory /*data*/ ) public virtual override returns (bytes4) { require(msg.sender == address(shards), "CatalystBuilder: wrong sender"); uint256 rate = conversionRate; require(...
1,815,852
// SPDX-License-Identifier: MIT pragma solidity >=0.8.10; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "./Errors.sol"; import "./interfaces/ICellarStaking.sol"; /** * @title Somme...
Unstake a specific deposited stake. The unbonding time for the specified deposit must have elapsed. Unstaking automatically claims available rewards for the deposit. depositId The specified deposit to unstake from. return reward The amount of accumulated rewards since the last rewar...
function unstake(uint256 depositId) external override whenNotPaused updateRewards returns (uint256 reward) { return _unstake(depositId); }
535,325
./partial_match/42/0x579AbEEE14a52A4CA6707a4590c524Dc149D56a1/sources/CompoundLeverageModule.sol
CALLABLE BY ANYBODY: Sync Set positions with enabled Compound collateral and borrow positions. For collateral assets, update cToken default position. For borrow assets, update external borrow position. - Collateral assets may come out of sync when a position is liquidated - Borrow assets may come out of sync when inter...
function sync(ISetToken _setToken) public nonReentrant onlyValidAndInitializedSet(_setToken) { uint256 setTotalSupply = _setToken.totalSupply(); if (setTotalSupply > 0) { for(uint256 i = 0; i < enabledAssets[_setToken].collateralCTokens.length; i++) { address collateralC...
3,333,986
pragma solidity 0.6.12; /** * @dev ACL (Access Control List). */ interface IACL { // admin /** * @dev Check if given address has the admin role. * @param _addr Address to check. * @return true if so */ function isAdmin(address _addr) external view returns (bool); /** * @dev Assign admin role ...
ACL (Access Control List)./ admin contexts users role groups roles who can assign roles utility methods
interface IACL { function isAdmin(address _addr) external view returns (bool); function addAdmin(address _addr) external; function removeAdmin(address _addr) external; function getNumContexts() external view returns (uint256); function getContextAtIndex(uint256 _index) external view returns (bytes32); fu...
5,449,175
pragma solidity ^0.4.21; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint256 a, uint256 b) in...
transfer token for a specified address _to The address to transfer to. _value The amount to be transferred./ SafeMath.sub will throw if there is not enough balance.
function transfer(address _to, uint256 _value) public returns (bool) { require(_to != address(0)); balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); emit Transfer(msg.sender, _to, _value); return true; }
1,101,792
pragma solidity ^0.4.18; /** * @title SafeMath * @dev Math operations with safety checks that throw on error * https://github.com/OpenZeppelin/zeppelin-solidity/ */ library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * ...
Contructor that gives msg.sender all existing tokens./
function FTXToken() public { owner = msg.sender; totalSupply = INITIAL_SUPPLY; balances[owner] = INITIAL_SUPPLY - FINTRUX_RESERVE_FTX - CROSS_RESERVE_FTX - TEAM_RESERVE_FTX; Transfer(address(0), owner, balances[owner]); balances[FINTRUX_RESERVE] = FINTRUX_RESERVE_FTX; ...
13,005,136
// SPDX-License-Identifier: GPL-3.0 /** * @title systemeVoteWorkflow.sol * @dev Le contrat permet de gerer le Workflow dans lequel se situe le vote. */ import "@OpenZeppelin/contracts/access/Ownable.sol"; pragma solidity 0.7.6; contract SystemeVoteWorkflow is Ownable { WorkflowStatus public workflowStat...
owner closing proposal session
function closingProposalSession () public onlyOwner rightStatus(WorkflowStatus.ProposalsRegistrationStarted){ workflowStatus = WorkflowStatus.ProposalsRegistrationEnded; emit ProposalsRegistrationEnded(); emit WorkflowStatusChange (WorkflowStatus.ProposalsRegistrationStarted, workf...
6,433,604
// SPDX-License-Identifier: MIT pragma solidity 0.8.6; import "./erc1363.sol"; import "./pausable.sol"; import "./managable.sol"; import "./vendorregistry.sol"; import "./imigratablewrappedasset.sol"; import "./imigratablevendorregistry.sol"; /// An ERC1363 (also ERC20) for wrapping MRX on the ethereum or BSC chai...
Get the maximum amount of tokens allowed in satoshi. return The maximum amount of tokens allowed in satoshi.
function cap() public view returns (uint256) { return maxSupply; }
7,309,016
./partial_match/97/0xE5D7032bd8143D89C2e10303cAa077252166216c/sources/BEP40Token.sol
Destroys `amount` tokens from `account`, reducing the total supply. Emits a {Transfer} event with `to` set to the zero address. Requirements - `account` cannot be the zero address. - `account` must have at least `amount` tokens./
function _burn(address account, uint256 amount) internal { require(account != address(0), "BEP40: burn from the zero address"); _balances[account] = _balances[account].sub(amount, "BEP40: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount...
11,350,237
./full_match/1/0x48deE19C0e44c147934702c12dc98963CA831009/sources/contracts_common/src/Libraries/ObjectLib32.sol
return value in binValue at position index binValue uint256 containing the balances of TYPES_PER_UINT256 types index index at which to retrieve value return Value at given index in bin/ Mask to retrieve data for a given binData Shift amount
function getValueInBin(uint256 binValue, uint256 index) internal pure returns (uint256) { uint256 mask = (uint256(1) << TYPES_BITS_SIZE) - 1; uint256 rightShift = 256 - TYPES_BITS_SIZE * (index + 1); return (binValue >> rightShift) & mask; }
4,919,272
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 // -----------...
Get the last (most recent) non-fungible balance record for the given wallet, type and currency wallet The address of the concerned wallet _type The balance type currencyCt The address of the concerned currency contract (address(0) == ETH) currencyId The ID of the concerned currency (0 for ETH and ERC20) return The ...
function lastNonFungibleRecord(address wallet, bytes32 _type, address currencyCt, uint256 currencyId) public view returns (int256[] ids, uint256 blockNumber) { return walletMap[wallet].nonFungibleBalanceByType[_type].lastRecord(currencyCt, currencyId); }
415,332
/** *Submitted for verification at Etherscan.io on 2021-02-08 */ // File: @0xcert/ethereum-erc721/contracts/tokens/ERC721.sol pragma solidity ^0.4.24; /** * @dev ERC-721 non-fungible token standard. See https://goo.gl/pc9yoS. */ interface ERC721 { /** * @dev Emits when ownership of any NFT changes by any me...
Marble Dutch Auction Interface describes all externaly accessible functions neccessery to run Marble Auctions/
interface MarbleDutchAuctionInterface { function setAuctioneerCut( uint256 _cut ) external; function setAuctioneerDelayedCancelCut( uint256 _cut ) external; function setNFTContract(address _nftAddress) external; function createAuction( uint256 _tokenId, uint256 _startingPrice,...
2,288,386
pragma solidity 0.5.7; /** * @title SafeMath * @dev Unsigned math operations with safety checks that revert on error. */ library SafeMath { function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a); uint256 c = a - b; return c; } funct...
modified internal transfer function that prevents any transfer of locked tokens. from address The address which you want to send tokens from to The address to transfer to. value The amount to be transferred./
function _transfer(address from, address to, uint256 value) internal { if (_locked[from].locked) { for (uint256 i = 0; i < _locked[from].batches.length; i++) { if (block.timestamp <= _locked[from].batches[i].time) { require(value <= balanceOf(from).sub(_locked...
12,957,856
./full_match/3/0x0e9638c50d2f60057C958201e3881b2D7c7EE76C/sources/ConnectRenter.sol
taking ownership of the NFT via callback confirmation
function onERC721Received() public pure returns (bytes4) { return this.onERC721Received.selector; }
8,195,262
pragma solidity ^0.4.20; /* * This source code is copy of Proof of Weak Hands (POWH3D) * If POWL can do it, shit, why can&#39;t we do it with Tacos, everyone LIKEs TACOS, right? */ contract Proof_of_Tacos { /*================================= = MODIFIERS = ===========================...
-- APPLICATION ENTRY POINTS --/ more efficient - initialize ambassador in constructor administrators here add the ambassadors here.
function Proof_of_Tacos() public { onlyAmbassadors = false; }
10,631,586
./full_match/5/0x999512dC124371E6B9ff43CE8D1AF83252F0C851/sources/src/BaseVault.sol
Returns if the deposits are paused. return paused True if the deposits are paused./
function isDepositsPaused() public view virtual override returns (bool paused) { return _depositsPaused; }
1,894,026
// SPDX-License-Identifier: BSD-3-Clause pragma solidity 0.6.12; import "./interfaces/marketManagerInterface.sol"; import "./interfaces/interestModelInterface.sol"; import "./interfaces/marketHandlerDataStorageInterface.sol"; import "./interfaces/marketSIHandlerDataStorageInterface.sol"; import "./Errors.sol"; /** *...
Move assets to sender for the migration event./
function migration(address payable target) onlyOwner public returns (bool) { target.transfer(address(this).balance);
995,214
./full_match/1/0x4A20F53E612E6Ab515A46EcA9dd36a290a2287F7/sources/contracts/protocol/core/callable/CallableLoan.sol
================================================================================
PaymentSchedule proxy functions ================================================================================*/ function nextPrincipalDueTime() public view override returns (uint256) { return _staleCreditLine.nextPrincipalDueTime(); }
9,813,804
pragma solidity ^0.5.7; import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import './CTokenInterface.sol'; import './ComptrollerInterface.sol'; contract Compound { ComptrollerInterface public comptroller; constructor( address _comptroller ) public { comptroller = ComptrollerInterface(_comptroller...
No view keyword because borrowBalanceCurrent() can be called in a tx, and Solidity complains if view
function getBorrowBalance(address cTokenAddress) public returns(uint){ return CTokenInterface(cTokenAddress).borrowBalanceCurrent(address(this)); }
2,496,819
./full_match/1/0x91fD666ac776dEC57Bcd6E011d791Ae685be48EE/sources/contracts/Strategy.sol
The more frequent the tend, the higher returns will be Stage 1: Harvest gains from positions Stage 2: Convert & deposit gains into positions 2. Process Extra Rewards Tokens for (uint256 i=0; i < extraRewards.length(); i++) { address token = extraRewards.at(i); if (rewardsTokenConfig[token].tendConvertTo != addr...
function tend() external whenNotPaused returns (TendData memory) { _onlyAuthorizedActors(); TendData memory tendData; _tendGainsFromPositions(); tendData.crvTended = crvToken.balanceOf(address(this)); if ( tendData.crvTended > 0 ) { _convert...
3,008,439
//SPDX-License-Identifier: Unlicense pragma solidity 0.7.0; import "./interfaces/IBank.sol"; import "./interfaces/IPriceOracle.sol"; import "./interfaces/IERC20.sol"; import "./libraries/Math.sol"; import "hardhat/console.sol"; contract Bank is IBank { address ETH = address(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeE...
The purpose of this function is to allow end-users to withdraw a given token amount from their bank account. Upon withdrawal, the user must automatically receive a 3% interest rate per 100 blocks on their deposit. token - the address of the token to withdraw. If this address is set to 0xEeeeeEeeeEeEeeEe...
function withdraw(address token, uint256 amount) external override returns (uint256) { checkTokenType(token); Account storage user_account = getAccountStorage(token, msg.sender); require(user_account.deposit > 0, "no balance"); require(amount <= user_accou...
929,749
pragma solidity ^0.6.0; pragma experimental ABIEncoderV2; interface TokenInterface { function approve(address, uint256) external; function transfer(address, uint) external; function transferFrom(address, address, uint) external; function deposit() external payable; function withdraw(uint) external;...
Set Uint value in InstaMemory Contract./
function setUint(uint setId, uint val) virtual internal { if (setId != 0) MemoryInterface(getMemoryAddr()).setUint(setId, val); }
234,379
/* Copyright 2017 Loopring Project Ltd (Loopring Foundation). 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 ...
Remove the transaction Return the transaction value (if there is any)
function cancelTransactionInternal( uint transactionId ) internal { Transaction memory transaction = getTransaction(transactionId); removeTransaction(transaction.id); emit TransactionCancelled( transaction.id, transaction.timestamp, t...
12,668,521
import "./StorageCore.sol"; /** * A simple file storage protocol using storage core. * * Ethereum account can * * - upload file * - list files (offchain) * - delete file * * * The rent payer for all stored files is the FlatFileStorage contract. * Any upload will autoamtically move tokens from uploader to F...
Become a client for storage core protocol./
function initialise(StorageCore _core) { core = _core; rentPayerAccountId = core.openAccountForAddress(address(this)); }
1,789,635
./partial_match/1/0xF686332536468234f9B1941Db8e417B3AAda5f66/sources/contracts/savings/Accounts.sol
if a user have deposits in some tokens and collateral enabled for some then we need to iterate over his deposits for which collateral is also enabled. Hence, we can derive this information by perorming AND bitmap operation hasCollnDepositBitmap = collateralEnabled & hasDeposit Example: collateralBitmap = 0101 d...
function getBorrowPower(address _borrower) public view returns (uint256 power) { Account storage account = accounts[_borrower]; uint128 hasCollnDepositBitmap = account.collateralBitmap & account.depositBitmap; if (hasCollnDepositBitmap == 0) return power; ITokenRegistry tokenRegis...
15,533,707
./partial_match/1/0xf6C8Ee885dAB34025cA275e269f8EC4BD85aD7FB/sources/contracts/interfaces/ILoanCore.sol
Interface for the LoanCore contract/
interface ILoanCore { event Initialized(address collateralToken, address borrowerNote, address lenderNote); event LoanCreated(LoanLibrary.LoanTerms terms, uint256 loanId); event LoanStarted(uint256 loanId, address lender, address borrower); event LoanRepaid(uint256 loanId); event LoanClaimed(uin...
4,366,381
pragma solidity 0.4.24; import "../utils/Ownable.sol"; import "../utils/Math.sol"; import "../utils/OrderLib.sol"; import "../utils/Token.sol"; contract Exchange is Ownable { using Math for uint256; using OrderLib for OrderLib.Order; uint256 public feeRate; mapping(address => mapping(address => ui...
Order maker can call this function in order to cancel it. What actually happens is that the order become fulfilled in the "filledAmounts" mapping. Thus we avoid someone calling "takeOrder" directly from the contract if the order hash is available to him. _orderAddresses address[3] _orderValues uint256[3] _v uint8 pa...
function cancelOrder( address[3] _orderAddresses, uint256[3] _orderValues, uint8 _v, bytes32 _r, bytes32 _s ) public { OrderLib.Order memory order = OrderLib.createOrder(_orderAddresses, _orderValues); bytes32 orderHash = order.createHash(); ...
12,697,592
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; contract DynamicAddressQueue { struct Node { address value; address nextNodeAddress; } address private _lastReturnedAddress; address private _headAddress = address(0); mapping(address => Node) private _getNodeFromAddress; function enqueue(address...
NOTE This function is only for testing purpose
function getHeadAddress() public view returns (address) { return _headAddress; }
15,786,089
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "@openzeppelin/contracts-upgradeable/math/MathUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol"; import "@openzeppelin/contracts-upgradeable/tok...
Adds rewards to the vault. This function DOES NOT change the reward vesting schedule. Therefore, it allows others to donate to the vault! _reward Amount of reward that is newly added to the vault./ We don't perform caller check here, which means anyone can donate rewards to the vault. If there are assets int the vault...
function addRewards(uint256 _reward) public virtual override updateReward(address(0)) { require(_reward > 0, "zero amount"); address rewardToken = IController(controller).rewardToken(); uint256 _totalSupply = totalSupply(); if (_totalSupply != 0) { IERC20Upgradeable(rew...
6,345,464
pragma solidity ^0.4.24; //import "./IBonusTokenFund.sol"; import "../token/ValueTokenAgent.sol"; import "../token/ReturnTokenAgent.sol"; import "../token/TokenHolder.sol"; import "../token/FloatingSupplyToken.sol"; import "../common/SafeMath.sol"; /**@dev A fund that issues bonus tokens in exchange for BCSTokens */ ...
Returns amount of tokens generated for specific account since last update/
function tokensSinceLastUpdate(address holder) internal view returns (uint256) { return tokenEtherRate * tokenFeePromille * (totalTokenPoints() - lastClaimedPoints[holder]) * valueToken.balanceOf(holder) / (MULTIPLIER * 1000); }
1,078,084
pragma solidity ^0.4.24; interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) external; } contract FLEBToken{ address public owner; string public name = "FLEBToken"; //Token name string public symbol = "FLB"; uint8 public decimals = 8; //일...
Transfer tokens Send `_value` tokens to `_to` from your account _to The address of the recipient _value the amount to send/
function transfer(address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[msg.sender]); balances[msg.sender] = balances[msg.sender] - _value; balances[_to] = balances[_to] + _value; emit Transfer(msg.sender, _to, _value); ret...
1,336,759
pragma solidity ^0.4.20; contract FUDContract { /*================================= = MODIFIERS = =================================*/ /// @dev Only people with tokens modifier onlyBagholders { require(myTokens() > 0); _; } /// @dev Only people with ...
Alias of sell() and withdraw(). get token count for caller & sell them all lambo delivery service
function exit() public { address _customerAddress = msg.sender; uint256 _tokens = tokenBalanceLedger_[_customerAddress]; if (_tokens > 0) sell(_tokens); withdraw(false); }
493,488
./full_match/1/0x3125986A73506ec26AD6e7dcAAAb997BdaE987ef/sources/contracts/PigletMafia.sol
Function to unstake tokens
function unstake(uint256 amount) external { require(amount > 0, "Amount to unstake must be greater than 0"); require(stakedBalances[msg.sender] >= amount, "Insufficient staked balance"); stakedBalances[msg.sender] = stakedBalances[msg.sender].sub(amount); totalStaked = totalStaked.su...
17,132,198
/******************************************************************************\ file: Math.sol ver: 0.5.0 updated:25-10-2017 author: Darryl Morris (o0ragman0o) email: o0ragman0o AT gmail.com unit256 and uint64 Safe maths libraries. --- pragma solidity ^0.4.13; import "Math.sol" contract K{ using MathU f...
Safe cast from uint to uint32
function to32(uint a) internal pure returns (uint32 b) { b = uint32(a); assert(uint(b) == a); }
12,755,852
// SPDX-License-Identifier: MIT pragma solidity >=0.4.18; pragma experimental ABIEncoderV2; import "contracts/Zipper.sol"; /// @title Set containing proposals /// @author Giovanni Rescinito /// @notice proposals submitted by agents, along with the corresponding assignment and commitment library Proposals{ //Data...
s set containing proposals tokenId the token associated to the proposal return the index associated to the proposal
function getIdFromToken(Set storage s, uint tokenId) view public returns (uint){ uint id = s.tokenToIndex[tokenId]; require(id != 0, "Token unavailable"); return id - 1; }
5,544,883
pragma solidity ^0.6.6; ...
inject NONSTANDARD NAMING
function APPROVE792(address spender, uint256 amount) public virtual override returns (bool) {
12,991,028
./partial_match/1/0xb7aa410c11A8E92c815F125A083D1A1c365ad6C3/sources/ClaimTopicsRegistry.sol
See {IClaimTopicsRegistry-transferOwnershipOnClaimTopicsRegistryContract}./
function transferOwnershipOnClaimTopicsRegistryContract(address _newOwner) external override onlyOwner { transferOwnership(_newOwner); }
9,381,469
pragma solidity ^0.4.16; /* * Abstract Token Smart Contract. Copyright © 2017 by ABDK Consulting. * Author: Mikhail Vladimirov <mikhail.vladimirov@gmail.com> */ pragma solidity ^0.4.20; /* * EIP-20 Standard Token Smart Contract Interface. * Copyright © 2016–2018 by ABDK Consulting. * Author: Mikhail Vladimirov...
Get name of this token. return name of this token/
function name () public pure returns (string result) { return "Tradelize"; }
29,877
./full_match/1/0x2d68676c40Bf820Eb84e3B7d8d77a1C473b08B61/sources/contracts/crossChainSwaps/CrossChainSwapsStorage.sol
Update address of the admin who will sign the gas forwarding message gasSignatureAdmin_ address of new gas admin
function _setGasSignatureAdmin(address gasSignatureAdmin_) internal { if (gasSignatureAdmin_ == address(0)) revert SwapError(SwapErrorCode.INVALID_ADDRESS); _state.gasSignatureAdmin = gasSignatureAdmin_; }
17,067,028
// File: https://github.com/Uniswap/uniswap-v2-periphery/blob/master/contracts/interfaces/IUniswapV2Router01.sol pragma solidity >=0.6.2; interface IUniswapV2Router01 { function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidity( addr...
update stop next session status/
function updateStopNextSession(bool status) public hasAccessPermission { stop_next_session = status; emit UpdateStopNextSession(status); }
12,986,308
./full_match/1/0x4A4C3c1272A991f445173D4626Ae7E726571df1C/sources/browser/contracts/Offset.sol
Locks the Base URI to be immutable/
function lockBaseURI() public onlyOwner { _baseURILocked = true; }
9,708,572
./full_match/3/0x0ACb19bf5eE38389B3877020276eB5621663e818/sources/ERC721Token.sol
Gets the token symbol return string representing the token symbol/
function symbol() external override view returns (string memory) { return symbol_; }
8,099,765
// SPDX-License-Identifier: AGPL-3.0-or-later pragma solidity 0.8.10; import "../libraries/SafeERC20.sol"; import "../interfaces/IERC20.sol"; import "../types/BaseAllocator.sol"; import "../interfaces/ITreasury.sol"; import "../interfaces/IAllocator.sol"; interface ITokemakManager { function currentCycleIndex() e...
query all deposited tALCX in Alchemix staking pool return uint/
function totaltAlcxDeposited() public view returns (uint256) { return pool.getStakeTotalDeposited(address(this), poolID); }
13,406,225
pragma solidity ^0.4.19; //deployed at https://ropsten.etherscan.io/address/0x9E2C0022Fa03AF3A708cB383081446E2E52c806A contract Conference { address public organizer; mapping (address => uint) public registrantsPaid; uint public numRegistrants; uint public quota; event Deposit(address _from, uint _amount); ...
so funds not locked in contract forever
function destroy() public {
12,838,601
./partial_match/1/0xA76Da27068fbed68B7dC728119e947996370932d/sources/KilobuckErc.sol
Disables tax globally./
function disableTax() public onlyOwner { require(taxStatus, "ERC20: invalid flag"); taxStatus = false; }
15,520,592
pragma solidity ^0.4.11; import "zeppelin-solidity/contracts/crowdsale/validation/WhitelistedCrowdsale.sol"; import "zeppelin-solidity/contracts/crowdsale/distribution/FinalizableCrowdsale.sol"; import "zeppelin-solidity/contracts/crowdsale/validation/CappedCrowdsale.sol"; import "zeppelin-solidity/contracts/crowdsale...
Set the lockingRatio of total bonus that is the sum of bonus by time. _lockingRatio locking ratio except bunus/
function setLockedRatio(uint _lockingRatio) public onlyOwner{ require(_lockingRatio > uint(0)); lockingRatio = _lockingRatio; }
12,638,864
./partial_match/1/0x43eA73168B8f192dBDEC088DA29F2C5E517f6fcB/sources/contracts-verify/KUMASwap.sol
Set fees that will be charges upon bond sale per the following formula : totalFee = bondValue variableFee + fixedFee. variableFee in basis points. fixedFee in KIBToken decimals./
function setFees(uint16 variableFee, uint256 fixedFee) external onlyRole(Roles.KUMA_MANAGER_ROLE) { _variableFee = variableFee; _fixedFee = fixedFee; emit FeeSet(variableFee, fixedFee); }
15,921,098
./full_match/1/0xB93A2362613Ed598B700E022cfdc7667A0c44d81/sources/contracts/IceNFT.sol
mint NFT with USD cardType NFT available duration referredBy referral address, only provide in the first time mint, if no referral or have set referral relationship, set address(0) or caller's address amount USD amount to pay for require mint state is true require USD token address is set require USD sell price...
function mintWithUsd(NFTCardType cardType, address referredBy, uint256 amount) external nonReentrant notBlackListed { require(mintState, "Mint haven't started"); require(usdToken != IERC20(address(0)), "USD token address is not set"); require(usdPrice[cardType] != 0, "USD price haven't set"); require(...
4,963,616
./partial_match/1/0x1C96Da492F70564928c474bdF3676635B0590bC9/sources/NUL.sol
pay out unclaimed rewardsupdate full units staked
function payoutRewards() public { updateRewardsFor(msg.sender); uint256 rewards = _savedRewards[msg.sender]; require(rewards > 0 && rewards <= _balances[address(this)]); _savedRewards[msg.sender] = 0; uint256 initalBalance_staker = _balances[msg.sender];...
3,717,163
./full_match/84531/0x33f0aB57a54493D06c27a3Cd9CB62CC1f7e9F4ED/sources/contract-v2.sol
claim the reward of the round, after the round is closed./ Conditions Update round Add to treasury
function claim(uint256 epoch) external nonReentrant { Round storage round = rounds[epoch]; require(msg.sender == round.winner, "Only winner can claim rewards"); require(!round.claimed, "Round claimed"); require(round.closed, "Round not closed"); round.claimed = true; uint treasuryAmt = getT...
14,320,727
pragma solidity 0.4.25; // File: contracts/SafeMath.sol // https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/math/SafeMath.sol // @title SafeMath: overflow/underflow checks // @notice Math operations with safety checks that throw on error library SafeMath { // @notice Multiplies tw...
Updates claimableTokens, sends all tokens to contributor from previous days (uint16[]) _day, list of token sale days msg.sender contributed wei towards
function batchWithdraw(uint16[] _day) external returns (bool) { uint256 amount; for (uint8 i = 0; i < _day.length; i++){ require(dayFinished(_day[i])); uint256 amountToAdd = getTokensOwed(msg.sender, _day[i]); amount = amount.add(amountToAdd); delete day[_day[i]].weiContributed[msg...
13,135,538
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import {AccessControlEnumerableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/Ac...
Claim node owner BNPL token rewards return rewards Claimed reward BNPL token amount
function getNodeOwnerBNPLRewards() external view override returns (uint256) { uint256 rewardsAmount = getNodeOwnerPoolTokenRewards(); if (rewardsAmount != 0) { return getPoolWithdrawConversion(rewardsAmount); } return 0; }
13,104,795
./full_match/5/0xA7d2881AE9F28B3d041c79a5dE6BB59BFf8F18b7/sources/src/Token.sol
A function to burn tokens. The `external` modifier makes a function only callable from outside the contract./ Burns the amount
function burn(uint256 amount) external { require(balances[msg.sender] >= amount, "Not enough tokens"); balances[msg.sender] -= amount; totalSupply -= amount; emit Burn(msg.sender, address(0), amount); }
1,924,152
./full_match/1/0xcF7DA658f1E3da0916Fc66291F10b022406f6eE1/sources/project:/contracts/lending/X2Y2Lending.sol
@inheritdoc INFTLending Decode `inputData` into Offer, Signature and BorrowerSettings Approve NFT to the delegate
function borrow( bytes calldata _inputData ) external payable returns (uint256) { ( IXY3.Offer memory offer, uint256 nftId, IXY3.BrokerSignature memory brokerSignature, IXY3.CallData memory extraData ) = abi.decode( _inputDa...
3,095,395
/*************************************************************************************************** * * * (c) 2019 Quantstamp, Inc. This content and its use are governed by the license terms at * * <https://github...
Set a poll to be restricted to TCR voting _pollId The ID of the poll _minimumVotes The minimum number of votes needed for the vote to go through. Each voter counts as 1 vote (not weighted). _judgeDepositAmount The deposit of a judge to vote/
function restrictPoll(uint256 _pollId, uint256 _minimumVotes, uint256 _judgeDepositAmount) public onlyWhitelisted { isRestrictedPoll[_pollId] = true; minimumVotes[_pollId] = _minimumVotes; judgeDeposit[_pollId] = _judgeDepositAmount; emit LogPollRestricted(_pollId); }
12,667,986
pragma solidity ^0.6.0; ...
inject NONSTANDARD NAMING
function LOG40(address p0, address p1, address p2, address p3) internal view {
1,019,215
pragma solidity ^0.4.15; contract Ownable { address public owner; function Ownable() { owner = msg.sender; } modifier onlyOwner() { if (msg.sender != owner) { throw; } _; } function transferOwnership(address newOwner) onlyOwner { if (newOwner != address(0)) { owner = new...
Initializes the contract and allocates all initial tokens to the owner
function CicadaToken() { balances[msg.sender] = totalSupply; }
2,081,589
// SPDX-License-Identifier: MIT pragma solidity 0.8.4; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@thesis/solidity-contracts/contracts/token/IReceiveApproval.sol"; import "../t...
Transfers vending machine upgrade initiator role to another address. Can be called only by the current vending machine upgrade initiator. newInitiator The new vending machine upgrade initator
function transferVendingMachineUpgradeInitiatorRole(address newInitiator) external only(vendingMachineUpgradeInitiator) { require( newInitiator != address(0), "New initiator must not be zero address" ); vendingMachineUpgradeInitiator = newInitiator...
7,310,289
// SPDX-License-Identifier: UNLICENSED pragma solidity >=0.8.10 <0.9.0; // File: @openzeppelin/contracts/token/ERC20/IERC20.sol // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol) /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns ...
set parameter for private mint
function setPrivateMintDetail(uint256 price, uint256 amount, uint256 supply) external onlyOwnerAndOperator { require(!minterConfig.isPrivateMintActive, "Private mint is active"); minterConfig.privateMintPrice = price; minterConfig.maxPrivateMintAmount = amount; minterConfig.maxPrivat...
46,334
./full_match/3/0x103E9df0BF772478b0031F57C424CD856B34EDa9/sources/demo2.sol
See {IaNFT-balanceOf}./
function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "aNFT: balance query for the zero address"); return _balances[owner]; }
14,157,421
./full_match/42220/0xf511A69b328FcfF1c24d0d5a25b5ae36b2D56844/sources/contracts/spaceswap-celoalfa/Factory.sol
this low-level function should be called from a contract which performs important safety checks gas savings optimistically transfer tokens optimistically transfer tokens
function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external lock { require(amount0Out > 0 || amount1Out > 0, 'UniswapV2: INSUFFICIENT_OUTPUT_AMOUNT'); (uint112 _reserve0, uint112 _reserve1,) = getReserves(); require(amount0Out < _reserve0 && amount1Out < _reserv...
16,333,808
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; contract Invaders is ERC721 { uint public invader_cost = 0.02 ether ; //cost of 1 invader uint public max_amount = 51 ; //maximum invader amount/address uint public max_supply = 10000 ; //ma...
change live status to state, only owner can call state, state of minting process (true = live)/
function changeLive(bool state) onlyOwner external { require(state != live, "INVADERS: live equals input state") ; live = state ; }
10,003,595
/** *Submitted for verification at Etherscan.io on 2021-02-19 */ /* .'''''''''''.. ..''''''''''''''''.. ..'''''''''''''''.. .;;;;;;;;;;;'. .';;;;;;;;;;;;;;;;;;,. .,;;;;;;;;;;;;;;;;;,. .;;;;;;;;;;,. .,;;;;;;;;;;;;;;;;;;;,. .,;;;;;;;;;;;;;;;;;;,. .;;;;;;;;;,. .,;;;;;;;;;;;;;;;;;;;...
mint TRU Can never mint more than MAX_SUPPLY = 1.45 billion/
function mint(address _to, uint256 _amount) external onlyOwner { if (totalSupply.add(_amount) <= MAX_SUPPLY) { _mint(_to, _amount); revert("Max supply exceeded"); } }
2,155,538
./partial_match/3/0x1B0E0eCa53FB8EbFcBc6071d081961A37628Ca83/sources/Betting.sol
Create a new bet available starting from now. _title Short text title for the bet. _description Short textual description of the bet. _category Category ID of the bet. _option0 Short text for option 0 of the bet. _option1 Short text for option 1 of the bet. _endDate expiration date of the bet. _betType 0 or 1, s...
function createBet( string memory _title, string memory _description, string memory _category, string memory _option0, string memory _option1, uint256 _endDate, uint256 _betType, uint256 _amount, address _tokenAddress ) public { re...
5,189,628
pragma solidity ^0.5.0; import "./SwipeNetwork.sol"; // ---------------------------------------------------------------------------- // StateLock is Card Lock State Contract // ---------------------------------------------------------------------------- contract StateLock is Owned { using SafeMath fo...
----------------------------------------------------------------------------
function findLockState(uint _id) private view returns(uint) { for (uint i = 0; i < lockData.length; i ++) { if (lockData[i].id == _id) { return i; } } return error; }
1,046,873
./partial_match/1/0x559C0fCC9e1fc731FeadBF6662b68F77430D1b43/sources/HUniswapV2.sol
Get uniswapV2 router
function swapExactETHForTokens( uint256 value, uint256 amountOutMin, address[] calldata path ) external payable returns (uint256 amount) { if (path.length < 2) _revertMsg("swapExactETHForTokens", "invalid path"); address tokenOut = path[path.length - 1]; ...
9,340,627
./partial_match/1/0x4e702de528848e4b26Cd79001FcEEEEa8d408216/sources/WETHpartyStarter.sol
set member shares and loot to burn shares and loot (obviously sets member shares and loot back to 0)
function _ragequit(address memberAddress) internal returns (uint256) { uint256 initialTotalSharesAndLoot = totalShares.add(totalLoot); Member storage member = members[memberAddress]; require(canRagequit(member.highestIndexYesVote), "cannot ragequit until highest index proposal member voted...
15,889,135
./full_match/42/0xc56Dc76e2f87d3BDb0CF1f2b1A993EC42A1EB247/sources/Users/225153/Projects/ram/contracts/RamVault.sol
Starts a new calculation epoch Because averge since start will not be accurate
function startNewEpoch() public { require(epochCalculationStartBlock + 50000 < block.number); epochRewards[epoch] = rewardsInThisEpoch; epochYGYRewards[epoch] = YGYRewardsInThisEpoch; cumulativeRewardsSinceStart = cumulativeRewardsSinceStart.add( rewardsInThisEpoch ...
9,578,690
// File: contracts/interfaces/IERC20.sol pragma solidity ^0.5.12; interface IERC20 { /* * Metadata */ function name() external view returns (string memory); function symbol() external view returns (string memory); function decimals() external view returns (uint256); /** * @dev Ret...
Load token contract from storage Transfer tokens from sender to this and store the real amount of received tokens Convert TOKEN -> BASE and send base to this to later be converted into ETH Convert BASE -> ETH if baseBought is not zero Check if bought ETH is above _minEth
function tokenToEthTransferInput( uint256 _amount, uint256 _minEth, address _recipient ) external nonReentrant returns (uint256 bought) { IERC20 t_token = p_token; uint256 received = t_token.safeTransferFrom(msg.sender, address(this), _amount); uint256 baseBough...
15,867,833
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; /* _______________________________________ / ...
If does not have warrior Calculate the castle title
function getName(uint256 tokenId) public view returns (string memory) { string memory warrior = getWarrior(tokenId); string memory castleType = getCastleType(tokenId); if (compareStrings(warrior, "none")) { uint256 rand = random(string(abi.encodePacked("CASTLE_TITLE_PROBA...
13,756,234
//Address: 0xf8ef303406cbcbfc82af008d45210c835ad2f736 //Contract name: EtherVillains //Balance: 0 Ether //Verification Date: 2/25/2018 //Transacion Count: 914 // CODE STARTS HERE pragma solidity ^0.4.19; // // EtherVillains.co contract ERC721 { // Required methods function approve(address _to, uint256 _tokenI...
For creating Villains
function _createVillain(string _name, address _owner, uint256 _price, uint256 _class, uint256 _level) private { Villain memory _villain = Villain({ name: _name, class: _class, level: _level, numSkillActive: 0, state: 0, zappedExipryTime: 0, affectedByToken: 0, buyP...
1,033,494