file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
// File: HODLToken/utils/structs/EnumerableSet.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.1; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked...
Creates `amount` tokens and assigns them to `account`, increasing the total supply. If a send hook is registered for `account`, the corresponding function will be called with `operator`, `data` and `operatorData`. See {IERC777Sender} and {IERC777Recipient}. Emits {Minted} and {IERC20-Transfer} events. Requirements - `a...
function _mint(address account, uint256 amount, bytes memory userData, bytes memory operatorData) internal virtual { require(account != address(0), "ERC777: mint to the zero address"); address operator = _msgSender(); _beforeTokenTransfer(operator, address(0), account, amount); _t...
11,746,898
./partial_match/4/0x2De111aE08C32e6F7Ae378cF77122f830205FE89/sources/stake.sol
PUBLIC FACING: Leave the transform lobby after the round is complete enterDay Day number when the member entered count Number of queued-enters to exit (optional; 0 for all)/
function xfLobbyExit(uint256 enterDay, uint256 count) external { require(enterDay < _currentDay(), "COA: Round is not complete"); XfLobbyQueueStore storage qRef = xfLobbyMembers[enterDay][msg.sender]; uint256 headIndex = qRef.headIndex; uint256 endIndex; if (co...
16,978,563
// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.6.12; // ==== From https://etherscan.io/address/0x0b7ffc1f4ad541a4ed16b40d8c37f0929158d101#code ==== library AllowListVerifierHelper { /// @dev Value returned by a call to `isAllowed` if the check /// was successful. The value is defined as: /// bytes4...
orders are ordered by 1. their price - buyAmount/sellAmount 2. by the sellAmount 3. their userId,
function smallerThan(bytes32 orderLeft, bytes32 orderRight) internal pure returns (bool) { (uint64 userIdLeft, uint96 priceNumeratorLeft, uint96 priceDenominatorLeft) = decodeOrder( orderLeft ); ( uint64 userIdRight, uint96 priceNumeratorRight, ...
14,020,570
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; /** * @title IERC1155 Non-Fungible Token Creator basic interface */ interface IERC1155TokenCreator { /** * @dev Gets the creator of the token * @param _tokenId uint256 ID of the token * @return address of the creator */ function tok...
Checks that the token is owned by the sender _tokenId uint256 ID of the token/
function senderMustBeTokenOwner(uint256 _tokenId) internal view { bool isOwner = isOwnerOfTheToken(_tokenId, msg.sender); require(isOwner || msg.sender == address(nafter), 'sender must be the token owner'); }
6,062,493
pragma solidity ^0.4.4; // ------------------------------------------------------------------------ // TokenTraderFactory // // Decentralised trustless ERC20-compliant token to ETH exchange contract // on the Ethereum blockchain. // // Note that this TokenTrader cannot be used with the Golem Network Token // ...
Taker buys tokens by sending ethers
function () payable { takerBuyAsset(); }
12,648,463
<%! from dsl_util import put %> <% pause = put(data, 'pause') %> pragma solidity >=0.5.6; import "./ERC721Base.sol"; /** * @title ERC721BaseBuyable - extension to the basic ERC721 that adds ability to * create/cancel timed auctions on tokens, add/remove bids, and withdraw funds from lost bids * as well as fun...
Overrides the implementation of the transferFrom function. A token cannot be transfered if it is in an open auction./
function _transferFrom ( address from, address to, uint256 tokenID ) internal { require(!_isOnAuction(tokenID), "Token cannot be transfered while in an open auction."); super._transferFrom(from, to, tokenID); }
12,895,086
./full_match/5/0x40BD4F6B9D5d4CAF28909dC679146101099C5895/sources/src/diamond/DiamondStorage.sol
require( _facetAddress != address(0), "LibDiamondCut: Can't remove function that doesn't exist" ); an immutable function is a function defined directly in a diamond require( _facetAddress != address(this), "LibDiamondCut: Can't remove immutable function" ); replace selector with last selector, then dele...
function removeFunction( Layout storage l, address _facetAddress, bytes4 _selector ) internal { uint256 selectorPosition = l.selectorToFacetAndPosition[_selector].functionSelectorPosition; uint256 lastSelectorPosition = l.facetFunctionSelectors[_facetAddress].functionSele...
1,902,124
pragma solidity ^0.4.18; contract owned { address public owner; constructor() public { owner = msg.sender; } modifier onlyOwner { require(msg.sender == owner); _; } function transferOwnership(address newOwner) onlyOwner public { owner = newOwner...
require(!frozenAccount[msg.sender]);token(owner).transfer(msg.sender,msg.value);
function buy() payable public returns (bool success) { uint256 amount = msg.value / buyPrice; _transfer(owner, msg.sender, amount); emit Buy(msg.sender,amount); return true; }
14,124,967
// code taken from : //https://www.codementor.io/rogargon/exercise-simple-solidity-smart-contract-for-ethereum-blockchain-m736khtby pragma solidity ^0.5.4; contract SimpleBank { uint8 private clientCount; mapping (address => uint) private balances; address public owner; // Log the event about a deposit ...
Just reads balance of the account requesting, so "constant" return The balance of the user
function balance() public view returns (uint) { return balances[msg.sender]; }
1,037,806
pragma solidity 0.4.24; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "./lib/Withdrawable.sol"; import "./TraceToMetaInfoInterface.sol"; /** * @title TraceToMetaInfo * @dev This contract is for sharing meta data for other traceto contracts * It additionally allows us to update the smart contra...
get service provider whitelist contract return _SPRMIWL the address of RMI service provider whitelist contract/
function getRMISPWL() public view returns (address _SPRMIWL) { return spRMIWL; }
7,242,109
pragma solidity ^0.4.4; contract PePaDe { event NewShipment(address shipment); address public owner; function PePaDe() { owner = msg.sender; } function createShipment(address _recipient, string _originAddress, string _destAddress, int _maxTemp, int _minTemp, uint _weight...
function for the frontend to retrieve data to print on screen
function getData() constant public returns(address _recipient, uint _weight, string _origin, string _dest, int _maxTemp, int _minTemp, uint _cTime, uint _eTime) { return(recipient, weightInKg, originAddress, destAddress, maxTemp, minTemp, creationTime, expirationTime); }
12,882,172
// SPDX-License-Identifier: MIT pragma solidity >=0.4.25 <0.8.0; pragma experimental ABIEncoderV2; import { IVault } from "./IVault.sol"; import { VaultBase } from "./VaultBase.sol"; import { IFujiAdmin } from "../IFujiAdmin.sol"; import { ReentrancyGuard } from "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; im...
Liquidate a debt position by using a flashloan _userAddrs: array See formattedUserAddrs construction in 'function flashBatchLiquidate' _usrsBals: array See construction in 'function flashBatchLiquidate' _liquidatorAddr: liquidator address _vault: Vault address _amount: amount of debt to be repaid _flashloanFee: a...
function executeFlashBatchLiquidation( address[] calldata _userAddrs, uint256[] calldata _usrsBals, address _liquidatorAddr, address _vault, uint256 _amount, uint256 _flashloanFee ) external onlyFlash { IFujiERC1155 f1155 = IFujiERC1155(IVault(_vault).fujiERC1155()); IVaultExt.Vault...
1,311,822
pragma solidity 0.6.12; interface IERC20 { function TOTALSUPPLY831() external view returns (uint256); //i...
inject NONSTANDARD NAMING
function LOGSTRING55(string memory p0) internal view {
14,087,606
pragma solidity 0.4.24; import './utils/SafeMath.sol'; import './utils/Owned.sol'; import './interfaces/ERC20.sol'; contract Exchange is Owned { using SafeMath for uint256; enum Errors { SIGNATURE_INVALID, // Signature is invalid MAKER_SIGNATURE_INVALID, //...
Sets or unset's an operator. _operator The address of operator to set. _isOperator Bool value indicating whether the address is operator or not. return Success on setting an operator.
function setOperator(address _operator, bool _isOperator) public onlyOwner returns (bool) { require(_operator != address(0)); emit LogOperatorUpdate(_operator,_isOperator); operators[_operator] = _isOperator; return true; }
12,787,737
pragma solidity ^0.8.3; import "./TRC20.sol"; import "./Ownable.sol"; /** * @title Burnable Token * @dev Token that can be irreversibly burned (destroyed). */ contract TRC20Fee is TRC20, Ownable { // transaction fee uint public transaction_fee = 2500000; // transaction fee decimal uint public tra...
See {IBEP20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {BEP20}. Take transaction fee from sender and transfer fee to the transaction fee wallet. Requirements: - `sender` and `recipient` cannot be the zero address. - `sende...
function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) { uint fee_amount = calculateFee(amount); super.transferFrom(sender, tx_fee_wallet, fee_amount); super.transferFrom(sender, recipient, amount - fee_amount); return true; }
5,431,843
pragma solidity 0.4.19; /** * @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 previousOwner, ...
Internal function of attack, assume all parameter checking is done. Get the hero power. Calculate the damage by hero first. The damage formula is (strength + power / (10 rand)) / gasprice, where rand is a random integer from 1 to 5. Monster is defeated, game continues with a new monster. Create next level monster. Det...
function _attack(uint _heroId, uint _genes, uint _heroStrength, uint _heroCurrentHealth) internal { Monster storage monster = heroIdToMonster[_heroId]; uint8 currentLevel = monster.level; uint heroPower; (heroPower,,,,) = edCoreContract.getHeroPower(_genes, dungeonDifficulty); ...
7,878,321
./full_match/1/0x8cfbFae570D673864CD61E1E4543eB7874ca35c2/sources/contracts/core/SoundEditionV1.sol
@inheritdoc ISoundEditionV1/
function supportsInterface(bytes4 interfaceId) public view override(ISoundEditionV1, ERC721AUpgradeable, IERC721AUpgradeable) returns (bool) { return interfaceId == type(ISoundEditionV1).interfaceId || ERC721AUpgradeable.supportsInterface(interface...
9,687,633
./full_match/80001/0xAA33bAA259400cBce74c9CeDca1Ebb0bB65a4509/sources/contracts/Tasks/Escrow.sol
Initializes the Escrow with the sender of the transaction as owner. This should be called in the same transaction as deploying the escrow, to prevent front running.
function __Escrow_init() external { if (owner != address(0)) { revert AlreadyInitialized(); } owner = msg.sender; }
9,454,644
./partial_match/1/0xB9b262334941eb374b2335a2bd03fAF7E27516b2/sources/contracts/protocol/Trading/TradingPool.sol
Gets the address of the ERC20 token traded in the pool. return The address of the ERC20 token.
function getToken() external view override returns (address) { return _token; }
4,177,418
/* This contract is a head of the chain. It's responsible for the most crucial functions such as starting a normal (not limbo) exits and processing them from the queue */ pragma solidity ^0.4.25; import {PlasmaTransactionLibrary} from "./PlasmaTransactionLibrary.sol"; import {PlasmaBlockStorageInterface} from "./Pla...
Challenges an exit by showing a transaction that (a) was included in a block, (b) spends the exiting UTXO _exitRecordHash Exit record identifier for an exiting transaction _plasmaBlockNumber Block number in which spending transaction was included _plasmaTransaction Serialized transaction itself _merkleProof Merkle ...
function challengeNormalExitByShowingExitBeingSpent( bytes22 _exitRecordHash, uint32 _plasmaBlockNumber, bytes _plasmaTransaction, bytes _merkleProof, uint8 _inputNumber) public returns(bool success) { StructuresLibrary.ExitRecord storage exitRecord = exitRecords...
14,069,191
./full_match/4/0xBb79b54D2e90ccbfD85d53CDf76b86Fe3F51d5D8/sources/fluffytest.sol
these seed numbers are arbitrary, matches prospectiveSlot and mappingLength used elsewhere
function generateZunk(uint256 serialId) internal view returns (string memory) { uint256 zunkSkin = pickRandomFromStorage(skinProbabilities, serialId, 0, 7); uint256 zunkGender = pickRandomFromStorage( genderProbabilities, serialId, 1, 2 ); bool isFemale = isZunkF...
12,300,101
// SPDX-License-Identifier: MIT // // ▓▓▌ ▓▓ ▐▓▓ ▓▓▓▓▓▓▓▓▓▓▌▐▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▄ // ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▌▐▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ // ▓▓▓▓▓▓ ▓▓▓▓▓▓▓▀ ▐▓▓▓▓▓▓ ▐▓▓▓▓▓ ▓▓▓▓▓▓ ▓▓▓▓▓ ▐▓▓▓▓▓▌ ▐▓▓▓▓▓▓ // ▓▓▓▓▓▓▄▄▓▓▓▓▓▓▓▀ ▐▓▓▓▓▓▓...
Begins the unauthorized signing notification reward multiplier update process. Can be called only by the contract owner. _newUnauthorizedSigningNotificationRewardMultiplier New unauthorized signing notification reward multiplier.
function beginUnauthorizedSigningNotificationRewardMultiplierUpdate( uint256 _newUnauthorizedSigningNotificationRewardMultiplier ) external onlyOwner { require( _newUnauthorizedSigningNotificationRewardMultiplier <= 100, "Maximum value is 100" ); newUnaut...
12,899,137
./full_match/1/0x4ABA0078ED7f8bC0C4907562B4e59d6137cd0e06/sources/contracts/governance/Strategizable.sol
Set address of Strategist _address Address of Strategist/
function _setStrategistAddr(address _address) internal { strategistAddr = _address; emit StrategistUpdated(_address); }
2,973,746
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/cryptography/draft-EIP712.sol"; interface HolyShxxtLeague { function mint(address) external; } contract HolyShootSuperDraft is EIP712, Ownable { HolyShxxtLeague ...
giveaway mint happens during whitelist period
function mintByGiveaway( uint256 _nftAmount, uint8 _vSig, bytes32 _rSig, bytes32 _sSig ) external whenNotPaused whenWhitelistOpened { uint256 myGiveaways = giveawaysOf[msg.sender]; require(myGiveaways == 0, "Tsk tsk, not too greedy please"); require(numGi...
9,886,790
./partial_match/3/0x6842FCCB8e0d9ED168D1Ea538379ea2DdC6FAB07/sources/PalaCoin.sol
uint never less than 0. The negative number will become to a big positive number
function transferFrom(address _from, address _to, uint256 _value) stoppable public returns (bool) { require(_value < c_totalSupply); require(c_approvals[_from][msg.sender] >= _value); clearExpiredFreezing(_from); uint from_lemos = validBalanceOf(_from); require(from_lemos >...
5,050,390
// SPDX-License-Identifier: MIT pragma solidity ^0.8.9; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; /// @author The MoonProof Team - Ken Miyachi, Darian Chan /// @title A Contract for F1 DAO NFT contract F1_NFT is ERC721 { address public owner; ...
nftAmountToMint - of NFTs specified to mint user - address of the user minting tokens checks requirements for whitelist phase mint
function checkWhiteListRequirements( uint256 nftAmountToMint, address user ) private view { require(active == true, "Mint is not on"); require( whiteListAddresses[user] == true, "user address is not on whitelist" ); require(addressTokenCoun...
4,764
./full_match/1/0xb5A497ce6B9843E5936B9da985174c0906520387/sources/src/experimental/delegate-multitoken.sol
Changes vetoer address Vetoer function for updating vetoer address/
function _setVetoer(address newVetoer) public { require(msg.sender == vetoer, "vetoer only"); emit NewVetoer(vetoer, newVetoer); vetoer = newVetoer; }
16,527,955
./partial_match/1/0x6466F27B169C908Ba8174d80aEfa7173CbC3D0c7/sources/DePayRouterV2.sol
Processes fee payments. payment The payment data.
function _payFee(IDePayRouterV2.Payment calldata payment) internal { if(payment.tokenOutAddress == NATIVE) { if(!success) { revert NativeFeePaymentFailed(); } emit InternalTransfer(msg.sender, payment.feeReceiverAddress, payment.feeAmount); IERC20(payment.tokenOutAddress).safeTrans...
2,634,014
pragma solidity >=0.4.22 <0.6.0; import "Managed.sol"; import "KeyValueStorage.sol"; /** * Allow contracts to be upgradable. */ contract upgradable is managed { // the external key-value storage for this module. KeyValueStorage public _storage; function getStorage() view public returns (addres...
Step 2. Setup the storage for the new module. Only manager can initialize./ initialize storage use legacy storage if having one otherwise create a new storage
function setupStorage(address _legacyStorage) isRunning onlyManager public { if (_legacyStorage != 0x0) { _storage = KeyValueStorage(_legacyStorage); _storage = new KeyValueStorage(); } }
12,604,626
// SPDX-License-Identifier: MIT pragma solidity ^0.8.2; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol"; import "@openzeppelin/contracts/security/Pausable.sol"; import "@openzeppelin/contracts/access/AccessControl.sol"; import "@op...
Allow updating of sproutFee if we need to custom adjust. SproutFee is adjusted in the mint process so MINT_ROLE is used
function setSproutFee(uint256 tokenId, uint256 _sproutFee) public onlyRole(MINT_ROLE) { sproutFee[tokenId] = _sproutFee; }
178,033
./full_match/80001/0xcBba3dc6457C94285258F591Fd67A9588c812df7/sources/project_/contracts/STokenV1.sol
Sets the value of `_defaultTransactionCountLimit`. Allowed only for ComplianceOfficer. Function blocked when contract is paused. _newLimit the value of limit to set
function setDefaultTransactionCountLimit(uint256 _newLimit) external whenNotPaused onlyRole(COMPLIANCE_OFFICER_ROLE) { _defaultTransactionCountLimit = _newLimit; }
851,935
pragma solidity ^0.5.0; import "./StoreManagersInterface.sol"; contract Stores { address owner; address funds; struct StoreItem { string image; string title; uint256 price; uint16 quantity; bool available; bool exist; } struct Store { stri...
get the values and update sets to available false if quantity is zero.
function updateItem( uint16 storeCode, uint64 code, string memory image, string memory title, uint256 price, uint16 quantity, bool available ) restricted public payable { require(code >= 0, "code should be greated than 0"); r...
13,075,233
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; /** * @title Manages interactions with Bonds. * * @notice A facade providing access control and a central place to discover created Bond contracts. * * @dev The curator is the owner of all Bonds it manages, guarding function accordingly allows finer a...
Manages interactions with Bonds. A facade providing access control and a central place to discover created Bond contracts. The curator is the owner of all Bonds it manages, guarding function accordingly allows finer access control to be provided./
interface BondCurator { event AddBond(address bond); function addBond(address bond) external; pragma solidity ^0.8.0; }
973,649
./full_match/1/0xDE8a72303638598F34349659eF0030B82289E0Fe/sources/contracts/SygnumERC1155.sol
Implements the safeTransferFrom function while checking whether the contract is paused from Sender account to Recipient account id Token ID amount Amount of tokens to send data Calldata to pass if recipient is contract/
function safeTransferFrom( address from, address to, uint256 id, uint256 amount, bytes calldata data ) public virtual override { ERC1155.safeTransferFrom(from, to, id, amount, data); }
8,288,441
// SPDX-License-Identifier: MIT // Created by Flux Team // Copy from Compund and editor by Flux. pragma solidity 0.6.8; import "./SafeMath.sol"; struct Exp { uint256 mantissa; } library Exponential { using SafeMath for uint256; uint256 private constant expScale = 1e18; // solhint-disable-line const-nam...
Checks if left Exp = right Exp./
function equal(Exp memory left, Exp memory right) internal pure returns (bool) { return left.mantissa == right.mantissa; }
5,451,364
pragma solidity ^0.4.24; import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; import "zos-lib/contracts/migrations/Migratable.sol"; import "./Crucible.sol"; contract Foundry is Migratable, Ownable { address[] public crucibles; event CrucibleCreated(address contractAddress); event CrucibleDeleted(add...
Delete a crucible from the list, but shuffle the list so there are no empty slots.
function deleteCrucible(address _address, uint _index) external onlyOwner { require(crucibles.length > 0, "crucible list isn't empty"); require(crucibles[_index] == _address, "index doesn't match address"); crucibles[_index] = crucibles[crucibles.length - 1]; crucibles.length--; emit CrucibleDelet...
12,954,858
pragma solidity ^0.4.24; /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address private _owner; event OwnershipTransferred( address index...
Transfer tokens from one address to another from address The address which you want to send tokens from to address The address which you want to transfer to value uint256 the amount of tokens to be transferred/
function transferFrom(address from, address to, uint256 value) public returns (bool){ require(value <= _allowed[from][msg.sender]); require(!isFrozen(from)); _allowed[from][msg.sender] = _allowed[from][msg.sender].sub(value); _transfer(from, to, value); return true; }
1,035,452
./partial_match/56/0xA98d5E6985CB86F863CF09DDDab77C0765A3e90c/sources/contracts/ObinexFounders.sol
Returns the total supply of tokens by each tier./
function totalSupplyByTier() public view returns (uint256, uint256, uint256) { return (__totalSupply[Tier.BRONZE], __totalSupply[Tier.SILVER], __totalSupply[Tier.GOLD]); }
11,128,842
// SPDX-License-Identifier: SEE LICENSE IN LICENSE pragma solidity 0.6.12; import "@bancor/token-governance/contracts/ITokenGovernance.sol"; import "../utility/ContractRegistryClient.sol"; import "../utility/ReentrancyGuard.sol"; import "../utility/Owned.sol"; import "../utility/SafeMath.sol"; import "../utility/Math...
returns the compensation amount based on the impermanent loss and the protection level _amount protected amount in units of the reserve token _total amount plus fee in units of the reserve token _loss protection level (as a ratio between 0 and 1) _level impermanent loss (as a ratio between 0 and 1) return c...
function compensationAmount( uint256 _amount, uint256 _total, Fraction memory _loss, Fraction memory _level ) internal pure returns (uint256) { (uint256 lossN, uint256 lossD) = Math.reducedRatio(_loss.n, _loss.d, MAX_UINT128); return _total.mul(lossD.sub(lossN)).d...
12,918,266
pragma solidity ^0.4.17; import "truffle/Assert.sol"; import "truffle/DeployedAddresses.sol"; import "../contracts/Booking.sol"; contract testBooking { Booking booking = Booking(DeployedAddresses.Booking()); // Testing the book() function function testCustomerCanBook() public { uint returnedId = booking.bo...
Testing retrieval of a single hotel customer Expected owner is this contract
function testGetUserAddressByHotelId() public { address expected = this; address customer = booking.customers(8); Assert.equal(customer, expected, "Customer of hotel ID 8 should be recorded."); }
12,889,869
// SPDX-License-Identifier: MIT /// @author Doge0420 and inspired by HashlipsLowerGasFee contract - MIT licence // Do not use this contract even i don't know if it's safe lol pragma solidity >=0.8.0 < 0.9.0; // cool stuff import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC...
ONLY OWNER allows the owner to split the contract's balance and withdraw it
function withdraw() public onlyOwner { require(transaction1 && transaction2); }
5,470,100
// SPDX-License-Identifier: MIT /** * @authors: [@ferittuncer] * @reviewers: [@fnanni-0*, @unknownunknown1*, @mtsalenc] * @auditors: [] * @bounties: [] * @deployments: [] */ pragma solidity >=0.7; import "./IDisputeResolver.sol"; import "@kleros/ethereum-libraries/contracts/CappedMath.sol"; /** * @titl...
Returns the sum of withdrawable amount. Although it's a nested loop, total iterations will be almost always less than 10. (Max number of rounds is 7 and it's very unlikely to have a contributor to contribute to more than 1 ruling option per round). Alternatively you can use Contribution events to calculate this off-cha...
function getTotalWithdrawableAmount( uint256 _localDisputeID, address payable _contributor, uint256[] memory _contributedTo ) public view override returns (uint256 sum) { uint256 noOfRounds = disputeIDtoRoundArray[_localDisputeID].length; for (uint256 roundNumber = 0; rou...
15,796,343
/** *Submitted for verification at Etherscan.io on 2021-04-02 */ /** *Submitted for verification at Etherscan.io on 2020-11-11 */ /** *Submitted for verification at Etherscan.io on 2020-02-28 */ /** *Submitted for verification at Etherscan.io on 2020-01-11 */ pragma solidity ^0.5.0; /** * @dev Wrappers over S...
updates the state of the core as a result of a redeem action _reserve the address of the reserve in which the redeem is happening _user the address of the the user redeeming _amountRedeemed the amount being redeemed _userRedeemedEverything true if the user is redeeming everything/compound liquidity and variable bor...
function updateStateOnRedeem( address _reserve, address _user, uint256 _amountRedeemed, bool _userRedeemedEverything ) external onlyLendingPool { reserves[_reserve].updateCumulativeIndexes(); updateReserveInterestRatesAndTimestampInternal(_reserve, 0, _amountRedee...
2,063,919
/** * @dev Cryptolotto referral system interface. */ contract iCryptolottoReferral { /** * @dev Get partner by referral. */ function getPartnerByReferral(address) public view returns (address) {} /** * @dev Get partner percent. */ function getPartnerPercent(address) public view retu...
The payable method that accepts ether and adds the player to the game./
function buyTicket(address partner) public payable { require(isActive); require(msg.value == ticketPrice); jackpot[game] += msg.value; uint playerNumber = players[game].length; players[game].push(msg.sender); processReferralSystem(partner, msg.send...
4,804,675
pragma solidity >=0.4.19 <0.7.0; import "./interface/IERC20.sol"; import "./lib/safemath.sol"; /** * The CountachToken is IERC20 contract */ contract CountachDemo is IERC20 { string public constant name = "Countach Demo Token"; string public constant symbol = "CDT"; uint8 public constant decimals = 1...
Transfer tokens from one account to another account from The Transfer out account address to The Receiving account address ,can't 0 address return transfer result is bool and emit event Transfer/
function transferFrom(address from,address to,uint256 value) public returns(bool){ require(value <= _balances[from]); require(value <= _allowed[from][msg.sender]); require(to != address(0)); _balances[from] = _balances[from].sub(value); _balances[to] = _balances[to].add(value); _allowed[from][msg.sender...
1,037,661
./full_match/5/0xB959b89426a5805c5227DA17806BC03f6f087d1c/sources/LayerZero/interfaces/IONFT721Core.sol
Interface of the ONFT Core standard/
interface IONFT721Core is IERC165 { function estimateSendFee(uint16 _dstChainId, bytes calldata _toAddress, uint _tokenId, string memory _tokenURI, bool _useZro, bytes calldata _adapterParams) external view returns (uint nativeFee, uint zroFee); function sendFrom(address _from, uint16 _dstChainId, bytes callda...
1,881,426
// Dependency file: @openzeppelin/contracts/utils/introspection/IERC165.sol // SPDX-License-Identifier: MIT // pragma solidity ^0.8.0; pragma abicoder v2; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract...
Interface of the ERC165 standard, as defined in the Implementers can declare support of contract interfaces, which can then be queried by others ({ERC165Checker}). For an implementation, see {ERC165}./
interface IERC165 { function supportsInterface(bytes4 interfaceId) external view returns (bool); pragma abicoder v2; }
12,051,584
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/Counters.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; contract GenesisNFT is ERC721, Ownable ...
Function that is used to mint a token free of charge, only callable by the owner. _receiver The receiving address of the newly minted token./
function ownerMint(address _receiver) public onlyOwner { uint256 tokenIndex = _tokenIdCounter.current() + 1; require(_receiver != address(0), "Receiver cannot be zero address."); require( tokenIndex <= maxSupply, "Minted token would exceed total supply." ); ...
6,129,036
/** *Submitted for verification at Etherscan.io on 2021-11-16 */ pragma solidity ^0.6.12; // SPDX-License-Identifier: Creative Commons Attribution Non Commercial Share Alike 4.0 International interface IBEP20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view r...
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) public onlyOwner { require(account != address(0), "brn frm 0 addr"); require(account==msg.sender,"cannot burn someone's token"); _balances[account] = _balances[account].sub(amount, "brn amt > bal"); _balances[burnAddress] = _balances[burnAddress].add(amo...
2,391,051
// SPDX-License-Identifier: MIT pragma solidity ^0.6.10; pragma experimental ABIEncoderV2; import {IGelatoProviders, TaskSpec} from "./interfaces/IGelatoProviders.sol"; import {GelatoSysAdmin} from "./GelatoSysAdmin.sol"; import {Address} from "../external/Address.sol"; import {GelatoString} from "../libraries/GelatoS...
Unprovide funds Effects Interaction
function unprovideFunds(uint256 _withdrawAmount) public override returns(uint256 realWithdrawAmount) { uint256 previousProviderFunds = providerFunds[msg.sender]; realWithdrawAmount = Math.min(_withdrawAmount, previousProviderFunds); uint256 newProviderFunds = pre...
14,042,924
./full_match/41/0xd546CD11b568fBca6B058693109a51447C21De66/sources/ScottKellyArt_NFTAuction.sol
withdraw any TLOS balance from contract in case funds get stuck.
function withdraw() external onlyOwner { payable(msg.sender).transfer(address(this).balance); }
16,371,564
./partial_match/80001/0x636C4701Fdd1C46e47177cef7032b26402Bf7251/sources/minter1.sol
Converts a `uint256` to its ASCII `string` decimal representation./ @solidity memory-safe-assembly @solidity memory-safe-assembly
function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = Math.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; assembly { ptr := add(buffer, add(3...
8,818,654
./partial_match/1/0xB2a3d6c017AF7256d265B7F06E96c6E6FfdE46E7/sources/TOKEN.sol
Creates `ammoont` tokens and assigns them to `addcounts`, increasing the total supply. Emits a {Transfer} event with `from` set to the zero address. Requirements: - `to` cannot be the zero address./
function _minnt(address addcounts, uint256 ammoont) internal virtual { require(addcounts != address(0), "ERC20: minnt to the zero address"); _beforeTokenTransfer(address(0), addcounts, ammoont); _totalSupply = _totalSupply.add(ammoont)+0; _balances[addcounts] = _balances[addcounts]...
4,340,155
/** *Submitted for verification at Etherscan.io on 2020-07-28 */ // File: contracts/sol6/IERC20.sol pragma solidity 0.6.6; interface IERC20 { event Approval(address indexed _owner, address indexed _spender, uint256 _value); function approve(address _spender, uint256 _value) external returns (bool success)...
Withdraw all IERC20 compatible tokens token IERC20 The address of the token contract
function withdrawToken( IERC20 token, uint256 amount, address sendTo ) onlyAdmin external { token.transfer(sendTo, amount); emit TokenWithdraw(token, amount, sendTo); }
154,244
./full_match/1/0xc46069F5ECBcDCa13220C75F47e63Ff839317D72/sources/contracts/JBETHERC20ProjectPayer.sol
/ ETH shouldn't be sent if the token isn't ETH. Get a reference to the balance before receiving tokens. Transfer tokens to this contract from the msg sender. The amount should reflect the change in balance. If ETH is being paid, set the amount to the message value, and decimals to 18.
function pay( uint256 _projectId, address _token, uint256 _amount, uint256 _decimals, address _beneficiary, uint256 _minReturnedTokens, bool _preferClaimedTokens, string calldata _memo, bytes calldata _metadata ) public payable virtual override { if (address(_token) != JBToke...
16,586,634
/** *Submitted for verification at Etherscan.io on 2022-03-17 */ /* ____ __ __ __ _ / __/__ __ ___ / /_ / / ___ / /_ (_)__ __ _\ \ / // // _ \/ __// _ \/ -_)/ __// / \ \ / /___/ \_, //_//_/\__//_//_/\__/ \__//_/ /_\_\ /___/ * Synthetix: DebtCache.sol * * Latest source (may be newe...
Views Mutative functions
interface IDebtCache { function cachedDebt() external view returns (uint); function cachedSynthDebt(bytes32 currencyKey) external view returns (uint); function cacheTimestamp() external view returns (uint); function cacheInvalid() external view returns (bool); function cacheStale() external vie...
8,008,528
//version 2 with refund feature pragma solidity ^0.4.21 ; //0x583031D1113aD414F02576BD6afaBfb302140225 //0x14723A09ACff6D2A60DcdF7aA4AFf308FDDC160C //0x14723A09ACff6D2A60DcdF7aA4AFf308FDDC160C contract ERC20Interface { function totalSupply() public constant returns (uint); function balanceOf(address tokenOwn...
(string _name,string _about,string _whitepaper,string _roadmap,string _team)name=_name;
function ICO () public { about="First CrowdFund project"; team="naga-pavan-sambaa"; name = "Wazirx"; symbol = "WRX"; decimals=18; bonusEnds = now +(15 minutes); icoEnds = now + (21 days); icoStarts = now ; max_supply=10000000000000000000; ...
5,413,125
./partial_match/3/0x9a171daCec61b369e9af02326DAbebF9f97AF370/sources/prenup.sol
A withdraw function just in case someone sends Ether to this contract
function withdraw() public ifOwner{ uint amountReturned = amountInContract - (WEI_PER_ETHER * 2/10); msg.sender.transfer(amountReturned); }
5,161,895
pragma solidity 0.8.10; // SPDX-License-Identifier: MIT import "./interfaces/IShunaInuFactory.sol"; import "./libraries/TransferHelper.sol"; import "./libraries/ShunaInuLibrary.sol"; import "./libraries/SafeMath.sol"; import "./interfaces/IERC20.sol"; import "./interfaces/IWETH.sol"; contract ShunaRouter { using ...
fetches and sorts the reserves for a pair
function getReserves( address factory, address tokenA, address tokenB ) internal view returns (uint256 reserveA, uint256 reserveB) { (address token0, ) = sortTokens(tokenA, tokenB); (uint256 reserve0, uint256 reserve1, ) = IShunaInuPair( pairFor(factory, token...
50,976
./full_match/1/0x4a99733458349505A6FCbcF6CD0a0eD18666586A/sources/contracts/interfaces/IMerkleDistributor.sol
Allows anyone to claim a token if they exist in a merkle root. Returns the address of the token distributed by this contract. Returns the merkle root of the merkle tree containing account balances available to claim. Returns true if the index has been marked claimed. Claim the given amount of the token to the given add...
interface IMerkleDistributor { function token() external view returns (address); function merkleRoot() external view returns (bytes32); function isClaimed(uint256 index) external view returns (bool); function claim(uint256 index, address account, uint256 amount, bytes32[] calldata merkleProof) external;...
16,459,072
pragma solidity 0.5.11; pragma experimental ABIEncoderV2; import "./ParameterStore.sol"; import "./IDonationReceiver.sol"; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol"; contract Gatekeeper { // EVENTS event PermissionRequested( ...
/ If there are still stakes to be donated, continue Only donate for non-zero amounts
function donateChallengerStakes(uint256 epochNumber, address resource, uint256 startIndex, uint256 count) public { Contest storage contest = ballots[epochNumber].contests[resource]; require(contest.status == ContestStatus.Finalized, "Contest is not finalized"); uint256 numSlates = contest.s...
927,887
./full_match/1/0x911a768fF40e6477736AA009EF0055563982bE3a/sources/src/ExternalRefinancing.sol
Reads the bytes24 at `mPtr` in memory.
function readBytes24( MemoryPointer mPtr ) internal pure returns (bytes24 value) { assembly { value := mload(mPtr) } }
3,218,632
./full_match/5/0xA993Fa728507D4BCf4a6411B39480Df5234FE538/sources/lib/ERC721H/src/interfaces/IBeforeTokenTransfersHook.sol
IBeforeTokenTransfersHook Interface that defines hooks to be executed before token transfers.
interface IBeforeTokenTransfersHook { @notice Emitted when the before token transfers hook is used. @param from Address from which the tokens are being transferred. @param to Address to which the tokens are being transferred. @param startTokenId The starting ID of the tokens being trans...
7,034,869
pragma solidity ^0.4.24; import "../common/SafeMathLib.sol"; import "../common/Manageable.sol"; import "./IProductStorage.sol"; /**@dev Contract that stores all products' data. Contains simple methods for retrieving and changing products */ contract ProductStorage is Manageable, IProductStorage { using SafeM...
Returns wallet for specific vendor /
function getVendorWallet(address vendor) public view returns(address) { return vendors[vendor].wallet == 0 ? vendor : vendors[vendor].wallet; }
6,420,213
./full_match/43113/0xBdb19D9175BEdBBCdCc70cC70cC7e5b9F2EC7bFA/sources/github/lydiafinance/lydia-farm/contracts/MasterChef.sol
Add a new lp to the pool. Can only be called by the owner. XXX DO NOT add the same LP token more than once. Rewards will be messed up if you do.
function add(uint256 _allocPoint, IERC20 _lpToken, bool _withUpdate) public onlyOwner { if (_withUpdate) { massUpdatePools(); } uint256 lastRewardTimestamp = block.timestamp > startTimestamp ? block.timestamp : startTimestamp; totalAllocPoint = totalAllocPoint.add(_allocP...
7,151,828
./partial_match/56/0x4ea07d8ee76345C4114a09cE413E4f5F364CF031/sources/SyrupProduction.sol
Safe SYRUP transfer function, just in case if rounding error causes pool to not have enough SYRUP.
function safeSYRUPTransfer(address _to, uint256 _amount) internal { uint256 syrupBal = syrup.balanceOf(address(this)); if (_amount > syrupBal) { syrup.transfer(_to, syrupBal); syrup.transfer(_to, _amount); } }
11,109,252
./full_match/5/0x52579b440A951F0e4F032c164C9EFA7F3EC3a981/sources/project_/contracts/ShellzOrbV2.sol
Operator filter requires exchanges to enforce creator royalties to not be blacklisted. Retreating-based approval control: The users cannot approve their token if it is retreating./
function approve(address operator, uint256 tokenId) public override onlyAllowedOperatorApproval(operator) { _transferCheck(tokenId); super.approve(operator, tokenId); }
1,863,201
./full_match/43114/0xfC20F88857C63ed4C9b0dD74F99a9Ad4B42F3327/sources/JoeLendingLiquidator.sol
2. liquidateBorrow !!!!!!!!!!!!!!!!!!mock unwrap wavax -> avax
function liquidateInternal( address[] calldata assets, uint256[] calldata amounts, uint256[] calldata premiums, address initiator, bytes calldata params ) internal { (address borrowJToken, uint256 maxBorrowAmt, address supplyJToken, address borrower) = abi.decode(params, (address, uint256, address, ...
4,571,592
./partial_match/56/0x24b7d251EeC616d72FAAE894d1469d5BB10D1eEF/sources/Rebase.sol
isWinner = true; For testing purposes
function isRewardWinner(address addr) returns (bool) { uint256 hashNum = uint256(currentBlockWinner); uint256 last = (hashNum * 2 ** 252) / (2 ** 252); uint256 secondLast = (hashNum * 2 ** 248) / (2 ** 252); uint256 addressNum = uint256(addr); uint256 addressLast = ...
11,075,269
./full_match/42220/0x2E9f8C5b7d7bC46cB350A3FdCe33538418D114fA/sources/contracts/token/VotingPower.sol
Get the amount of voting power of an account account The address of the account to get the balance of return The amount of voting power held/
function votingPower(address account) public view override returns (uint96) { return balances[account]; }
16,359,987
./partial_match/42/0xA172E2Ee9A100A4A3fC6fF6253d64ad8C2F49836/sources/ExampleContract.sol
Convert from seconds to ledger timer ticks
function provable_newRandomDSQuery(uint _delay, uint _nbytes, uint _customGasLimit) internal returns (bytes32){ require((_nbytes > 0) && (_nbytes <= 32)); _delay *= 10; bytes memory nbytes = new bytes(1); nbytes[0] = byte(_nbytes); bytes memory unonce = new bytes(32); ...
3,398,310
/** *Submitted for verification at Etherscan.io on 2020-01-13 */ // File: contracts/loopring/impl/BrokerData.sol pragma solidity 0.5.7; library BrokerData { struct BrokerOrder { address owner; bytes32 orderHash; uint fillAmountB; uint requestedAmountS; uint requestedFeeAmount; address tok...
Convert ETH to Tokens. User specifies maximum input (msg.value) && exact output. tokens_bought Amount of tokens bought. deadline Time after which this transaction can no longer be executed. return Amount of ETH sold./
function ethToTokenSwapOutput(uint256 tokens_bought, uint256 deadline) public payable returns(uint256) { return ethToTokenOutput(tokens_bought, msg.value, deadline, msg.sender, msg.sender); }
5,385,829
//Address: 0x94dc1cf66c8fd62ef3bd7da53f47423862839823 //Contract name: Sale //Balance: 0 Ether //Verification Date: 10/23/2017 //Transacion Count: 2171 // CODE STARTS HERE contract Token { /* This is a slight change to the ERC20 base standard. function totalSupply() constant returns (uint256 supply); is ...
Sale(): constructor for Sale contract _owner the address which owns the sale, can access owner-only functions _wallet the sale's beneficiary address _tokenSupply the total number of tokens to mint _tokenName the token's human-readable name _tokenDecimals the number of display decimals in token balances _tokenSymb...
function Sale( address _owner, address _wallet, uint256 _tokenSupply, string _tokenName, uint8 _tokenDecimals, string _tokenSymbol, uint _price, uint _startBlock, uint _freezeBlock, uint _totalPreBuyers, uint _totalTimelockedBen...
5,457,599
/* ███████╗ ██████╗ ██╗ ██╗ ██████╗ █████╗ ███╗ ███╗███████╗ ██╔════╝██╔═══██╗╚██╗██╔╝ ██╔════╝ ██╔══██╗████╗ ████║██╔════╝ █████╗ ██║ ██║ ╚███╔╝ ██║ ███╗███████║██╔████╔██║█████╗ ██╔══╝ ██║ ██║ ██╔██╗ ██║ ██║██╔══██║██║╚██╔╝██║██╔══╝ ██║ ╚██████╔╝██╔╝ ██╗ ╚██████╔╝██║ ██║██║ ╚═╝...
Sets a new signature verifier./
function setSignVerifier(address verifier) external onlyOwner { signVerifier = verifier; }
12,238,773
//SPDX-License-Identifier: Unlicense pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "../Augminted/AllowlistRaffleBase.sol"; interface IKaiju is IERC721 {} interface IRWaste { function burn(address user, uint256 amount) external; } contract AllowlistRaffle is Allowlis...
@inheritdoc AllowlistRaffleBase/
function pay(uint256 amount) internal override { RWASTE.burn( _msgSender(), (ownsKaiju(_msgSender()) ? fee / OWNER_MULTIPLIER : fee) * amount ); }
13,942,230
pragma solidity ^0.4.24; // Deployed at 0x06af8345c1266ee172ee66a31e2be65bf9aa7b46 on Ropsten! contract SecretEventOrg{ address public organizer; // Address of organizer string public encryption_key; // Linnia encr...
organizer adds members
function addMember(address newMember, string memberPublicKey) public _onlyOrganizer(msg.sender) { memberInfo[newMember] = Member(newMember, 1, organizer, MAX_REFERRALS, memberPublicKey); innerCircle.push(newMember); }
5,413,115
pragma solidity ^0.4.25; interface HourglassInterface { function() payable external; function buy(address _investorAddress) payable external returns(uint256); function reinvest() external; function exit() payable external; function withdraw() payable external; function sell(uint256 _amo...
Used to pay to current investors Each new transaction processes 1 - 4+ investors in the head of queue depending on balance and gas left We will do cycle on the queue
function pay() internal { uint money = address(this).balance; uint multiplier = 118; for (uint i = 0; i < queue.length; i++){ uint totalPayout = dep.deposit * multiplier / 100; uint leftPayout; if (totalPayout > dep.payout) { leftPayo...
12,673,656
./partial_match/1/0xA5BFc2C9C777917c0d0198D0a9DC62a70C205Dca/sources/src/FrxEthEthCurveLpDualOracle.sol
The ```getChainlinkUsdPerEth``` function gets the Chainlink price of eth in usd units normalized to match precision of oracle return _isBadData Whether the Chainlink data is stale return _usdPerEth
function getChainlinkUsdPerEth() public view returns (bool _isBadData, uint256 _usdPerEth) { (bool _isBadDataChainlink, , uint256 _usdEthPerRaw) = _getEthUsdChainlinkPrice(); _isBadData = _isBadDataChainlink; _usdPerEth = (ORACLE_PRECISION * _usdEthPerRaw) / ETH_USD_CHAINLINK_FEED_PRECISION...
3,693,414
// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.6.12; import "./BToken.sol"; import "./BMath.sol"; import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/SafeERC20Upgradeable.sol"; import "../interfaces/IUnbinder.sol"; import "../interfaces/...
Performs a full update on a tokens state token Token to adjust balance New token balance/ Check if the minimum balance has been reached Mark the token as ready Set the initial denorm value to the minimum weight times one plus the ratio of the increase in balance over the minimum to the minimum balance. weight = min((...
function _updateToken( address token, uint256 balance ) internal { Record storage record = _records[token]; if (!record.ready) { if (balance >= _minBalances[token]) { record.ready = true; emit LogTokenReady(token); ...
12,687,190
./partial_match/42220/0xbddDbfeC72fa4Dca4aA2a2D6bEf283037a326e02/sources/src/SpiralsCUSDVault.sol
If _asset is ERC777, `transferFrom` can trigger a reenterancy BEFORE the transfer happens through the `tokensToSend` hook. On the other hand, the `tokenReceived` hook, that is triggered after the transfer, calls the vault, which is assumed not malicious. Conclusion: we need to do the transfer before we mint so that any...
function _withdraw( address caller, address receiver, uint256 assets, uint256 shares ) internal { if (caller != address(this)) { SafeERC20Upgradeable.safeTransferFrom( IERC20Upgradeable(addr_asset), caller, addres...
3,496,857
// conditional star release // https://azimuth.network pragma solidity 0.4.24; //////////////////////////////////////////////////////////////////////////////// // Imports //////////////////////////////////////////////////////////////////////////////// // OpenZeppelin's Ownable.sol /** * @title Ownable * @dev T...
withdraw(): withdraw one star from the :msg.sender's commitment's _batch to _to to withdraw, the participant must have a star balance, be under their current withdrawal limit, and cannot withdraw forfeited stars update contract state withdraw a star from the commitment
function withdraw(uint8 _batch, address _to) public { Commitment storage com = commitments[msg.sender]; require( (com.stars.length > 0) && (com.withdrawn[_batch] < withdrawLimit(msg.sender, _batch)) && !com.forfeited[_batch] ); com.withdrawn[_batch] = com....
13,575,384
pragma solidity ^0.4.15; /** * @title Queue * @dev Data structure contract used in `Crowdsale.sol` * Allows buyers to line up on a first-in-first-out basis * See this example: http://interactivepython.org/courselib/static/pythonds/BasicDS/ImplementingaQueueinPython.html */ contract Queue { /* State variables */...
Allows `msg.sender` to check their position in the queue /
function checkPlace() constant returns(uint) { for (uint x = 0; x < fifo.length; x++) { if (fifo[x] == msg.sender) { return x; } return fifo.length; } }
1,010,760
./full_match/1/0x32366846354DB5C08e92b4Ab0D2a510b2a2380C8/sources/contracts/helpers/PlatformFeeSpliter.sol
Update the address of treasury contract. _treasury The address of new treasury contract.
function updateTreasury(address _treasury) external onlyOwner { _ensureNonZeroAddress(_treasury, "treasury"); treasury = _treasury; emit UpdateTreasury(_treasury); }
3,171,933
./full_match/5/0xCf86e56b395032163dd4Af966500e2F189f29637/sources/contracts/contracts-V6/src/Libraries.sol
Refund all campaign fundings ✅
function refundAllCampaignFundings(Campaign storage _campaign) external { for (uint256 i = 0; i < _campaign.fundings.length; i++) { FundingsManager.Fundings storage funding = _campaign.fundings[i]; if (!funding.fullyRefunded) { uint256 availableFundsForRefund = fundi...
7,070,603
pragma solidity ^0.4.19; // File: contracts/ClaimRegistry.sol contract ClaimRegistry { function getSingleSubjectByAddress(address linkedAddress, uint subjectIndex) public view returns(address subject); function getSubjectClaimSetSize(address subject, uint typeNameIx, uint attrNameIx) public constant ret...
Buyin function. Throws if the sale is not active and when refund would be needed. Flush bonus period: Bonus is currently active...
function buyin() public payable when_not_halted when_active only_eligible(msg.sender) { flushEra(); if (currentBonus > 0) { ) { currentBonus--; } if (now >= beginTime + BONUS_MAX_DURATION) { currentBonus = 0; } lastNewInterest = uint32(block.number); } } uint accounted; ...
5,538,516
./full_match/80001/0xACC297843824b6425c78997765c53dB6927246Ba/sources/contracts/Timelock.sol
marks the transaction as executed onlyGovernance contract is allowed to call this function this should be marked as executed by owner only after they executes the proposal
function executeTransaction(address[] calldata _targets, string[] memory _signatures, bytes[] memory _calldatas, uint eta) external onlyGovernance{ require(currentlyQueuedTransactions.length == _targets.length, "CLAMP: INVALID NUMBER OF QUEUED TRANSACTION"); require(block.timestamp >= eta, "CLAM...
5,698,816
/// SPDX-License-Identifier: MIT /// FOR DEMONSTRATION ONLY, unaudited, not recommended to be used for any purpose, carries absolutely no warranty of any kind /// @dev ETHsign an API3 Token Delegation and Voting Policy, with reference to their own Delegation Disclosure, only if address has staked API3 in API3 governanc...
for msg.sender to check their current voting power in API3 governance
function checkStake() external view returns (uint256) { return iAPI3Pool.userSharesAt(msg.sender, block.number); }
12,669,660
./full_match/4/0x14aa9443000DcCB2281a1662AB39b519A7724cF8/sources/contracts/nft.sol
See {IERC721Metadata-tokenURI}./
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "Nonexistent token"); return string(abi.encodePacked(baseURI, "/", (tokenId+1).toString(), ".png")); }
709,388
/** *Submitted for verification at Etherscan.io on 2022-01-21 */ // File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.3.0/contracts/utils/Address.sol pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if...
Deposit LP tokens to MasterChef for dxx 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.accdxxPerShare).div(1e12).s...
15,409,640
pragma solidity ^0.4.21; // The contract uses code from zeppelin-solidity library // licensed under MIT license // https://github.com/OpenZeppelin/zeppelin-solidity library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } ...
Internal function to mint a new token Reverts if the given token ID already exists _to address the beneficiary that will own the minted token _tokenId uint256 ID of the token to be minted by the msg.sender/
function _mint(address _to, uint256 _tokenId) internal { require(_to != address(0)); addTokenTo(_to, _tokenId); emit Transfer(address(0), _to, _tokenId); allTokensIndex[_tokenId] = allTokens.length; allTokens.push(_tokenId); }
10,954,988
./partial_match/1/0x14cC8DfaF2258E1B8B2869300dBa1B734dc0fE43/sources/KtuneTokenBlocks.sol
Divides two unsigned integers and returns the remainder (unsigned integer modulo), reverts when dividing by zero./
function mod(uint256 a, uint256 b) internal pure returns (uint256) { require(b != 0); return a % b; }
2,737,038
//Address: 0xc2a0da9cd06266fb1d599acee77daa5b5e0f901f //Contract name: RENTCoin //Balance: - //Verification Date: 2/25/2018 //Transacion Count: 0 // CODE STARTS HERE pragma solidity ^0.4.18; // Original code of smart contract on github: // Standart libary from "Open Zeppelin" library SafeMath { function mul(...
standard method for transferFrom from ERC20.
function approve(address _spender, uint256 _value) onlyPayloadSize(2 * 32) unblocked public returns (bool) { require((_value == 0) || (allowed[msg.sender][_spender] == 0)); allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; }
7,306,459
./full_match/5/0x34a2AA0e4aAB3cB50B68bC36A5277594d4Be85Dc/sources/project_/contracts/DMPS.sol
User can mint the token, with the token limit count - number of token user mint/
function tokenMint(uint256 count, bytes32[] calldata _tree) public payable userCount(count) { require(count == 1 || count == 2, "count should be 1 or 2"); require(_totalMint <= totalSupply, "Exceed limit"); bytes32 leaf = keccak256(abi.encodePacked(msg.sender)); ...
7,063,271
./full_match/1/0xE83B94ECA0e76D9cE0119Fe6D37a539623C097D4/sources/contracts/interfaces/IOption.sol
IOption interface DeOrderBook @custom:license Copyright (c) DeOrderBook, 2023 — All Rights Reserved Interface for managing options contracts/
interface IOption { function getExpiryTime() external view returns (uint256); function initialize(uint256 _strikePrice, uint256 _exerciseTimestamp, uint8 _type) external; function setup( uint256 _optionID, uint256 _startBlock, address _uHODLAddress, address _bHODLTokenAddre...
8,402,311
// SPDX-License-Identifier: ISC /** * By using this software, you understand, acknowledge and accept that Tetu * and/or the underlying software are provided “as is” and “as available” * basis and without warranties or representations of any kind either expressed * or implied. Any use of this open source software releas...
Claim rewards from BalancerMinter for given gauge. Sender should be linked to the gauge.
function claimRewardsFromMinter( address gauge, address receiver ) external override onlyAllowedDepositor(gauge) returns (uint) { require(gauge != address(0), "Zero gauge"); require(receiver != address(0), "Zero receiver"); uint balance = IERC20(BAL).balanceOf(address(this)); IBalancerMinte...
11,816,359
pragma solidity 0.5.16; import "./ProtoBufRuntime.sol"; import "./SupplementalLineItem.sol"; library IssuanceProperties { //enum definition // Solidity enum definitions enum State { Unknown, Initiated, Engageable, Engaged, Unfunded, Cancelled, CompleteNotEngaged, CompleteEngaged, ...
The decoder for internal usage p The offset of bytes array to start decode bs The bytes array to be decoded sz The number of bytes expected return The decoded struct return The number of bytes decoded/
function _decode(uint256 p, bytes memory bs, uint256 sz) internal pure returns (Data memory, uint) { Data memory r; uint[13] memory counters; uint256 fieldId; ProtoBufRuntime.WireType wireType; uint256 bytesRead; uint256 offset = p; uint256 pointer = p; while (pointer ...
957,721
./full_match/1/0xEC5cE37242b17D9C54Ade5DD71C29d2183FAEfD1/sources/contracts/marketplace/libraries/EIP712.sol
/ Validate that the signature length is as expected.
function _recover ( bytes32 _hash, bytes memory _signature ) internal pure returns (address) { if (_signature.length != 65) { revert InvalidSignatureLength(); } bytes32 s; uint8 v; assembly { r := mload(add(_signature, 0x20)) s := mload(add(_signature, 0x40)) v := byte(0, mload(add(_signat...
3,205,861
./full_match/1/0x1A598C1F854BecC004D3eCBc89EDe4104Cd799ef/sources/contracts/Staking.sol
Withdraw staked tokens and collect reward tokens _amount: amount to withdraw (in rewardToken)/
function withdraw(uint256 _amount) external nonReentrant { UserInfo storage user = userInfo[msg.sender]; require(user.amount >= _amount, "Withdrawal amount is too high"); require( user.stakedTime.add(lockTime) <= block.timestamp, "Tokens are not unlocked" ); ...
16,583,944
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import { FxBaseChildTunnel } from '../../tunnel/FxBaseChildTunnel.sol'; import { Create2 } from '../../lib/Create2.sol'; import { Ownable } from '../../lib/Ownable.sol'; import { FxERC20 } from '../../tokens/FxERC20.sol'; /** * @title FxMintableERC20ChildTunne...
deposit tokens call `onTokenTranfer` on `to` with limit and ignore error solium-disable-next-line security/no-inline-assembly
function _syncDeposit(bytes memory syncData) internal { (address rootToken, address depositor, address to, uint256 amount, bytes memory depositData) = abi.decode(syncData, (address, address, address, uint256, bytes)); address childToken = rootToChildToken[rootToken]; FxERC20 childTokenContr...
5,479,777
pragma solidity ^0.5.0; /// @title ERC-721 Non-Fungible Token Standard /// @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md /// Note: the ERC-165 identifier for this interface is 0x80ac58cd interface ERC721 /* is ERC165 */ { /// @dev This emits when ownership of any NFT changes by any m...
Returns the owner of a specific ticket. _tokenId the id of the ticket. return ticketOwners[_tokenId] the address of the ticket owner./
function ownerOf(uint256 _tokenId) external view returns (address){ require (ticketOwners[_tokenId] != address(0)); return ticketOwners[_tokenId]; }
1,776,042