file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
pragma solidity 0.4.18; // File: contracts/ERC20Interface.sol // https://github.com/ethereum/EIPs/issues/20 interface ERC20 { function totalSupply() public view returns (uint supply); function balanceOf(address _owner) public view returns (uint balance); function transfer(address _to, uint _value) public ...
wei per dollar from makerDaobuy digix with ether == sell ethersell digix == buy ether with digix
function getConversionRate(ERC20 src, ERC20 dest, uint srcQty, uint blockNumber) public view returns(uint) { if (!tradeEnabled) return 0; if (makerDaoContract == MakerDao(0)) return 0; uint feedBlock; uint nonce; uint ask1KDigix; uint bid1KDigix; blockNumber; ...
6,236,722
pragma solidity ^0.5.0; import "../interfaces/IPMTokenRolesStorage.sol"; import "./BaseStorage.sol"; /** * @title Permission module token roles storage */ contract PMTokenRolesStorage is IPMTokenRolesStorage, BaseStorage { /** * @notice Write info to the log when the new role was added to the wallet */ ...
Add token dependent role to the list wallet Wallet address token Address of the token role Role name index Index/
function setToTheTokenDependentList( address wallet, address token, bytes32 role, uint index ) public onlyPermissionModule(msg.sender) { listOfTheTokenDependentRoles[wallet][token][index] = role; }
6,488,825
//SPDX-License-Identifier: MIT pragma solidity 0.8.2; import "@openzeppelin/contracts-0.8/token/ERC721/IERC721Receiver.sol"; import "@openzeppelin/contracts-0.8/token/ERC1155/IERC1155Receiver.sol"; import "./ClaimERC1155ERC721ERC20.sol"; import "../../common/BaseWithStorage/WithAdmin.sol"; /// @title MultiGiveaway c...
Function to check which giveaways have been claimed by a particular user. user The user (intended token destination) address. rootHashes The array of giveaway root hashes to check. return claimedGiveaways The array of bools confirming whether or not the giveaways relating to the root hashes provided have been claimed...
function getClaimedStatus(address user, bytes32[] calldata rootHashes) external view returns (bool[] memory) { bool[] memory claimedGiveaways = new bool[](rootHashes.length); for (uint256 i = 0; i < rootHashes.length; i++) { claimedGiveaways[i] = claimed[user][rootHashes[i]]; } ...
1,018,700
pragma solidity ^0.4.24; import "zos-lib/contracts/Initializable.sol"; import "openzeppelin-eth/contracts/ownership/Ownable.sol"; import "openzeppelin-eth/contracts/lifecycle/Pausable.sol"; import "./AttributeRegistryInterface.sol"; import "./BasicJurisdictionInterface.sol"; /** * @title Organizations validator con...
Add an organization at account `organization` and with an initial allocation of issuable attributes of `maximumIssuableAttributes`. organization address The account to assign to the organization. maximumIssuableAttributes uint256 The number of issuable accounts./ check that an empty account was not provided by mistak...
function addOrganization( address organization, uint256 maximumIssuableAttributes, string name ) external onlyOwner whenNotPaused { require(organization != address(0), "must supply a valid account address"); require( _organizations[organization].exists == false, "an organization alr...
12,974,531
pragma solidity ^0.4.21; // ---------------------------------------------------------------------------- // Contract owner and transfer functions // just in case someone wants to get my bacon // ---------------------------------------------------------------------------- contract ContractOwned { address pub...
Minimal query for battle contract return If for fusion/
function queryFusionData_ext(uint _tokenId) public view returns ( bool forFusion, uint fusionPrice ) { return ( chibies[_tokenId].forFusion, chibies[_tokenId].fusionPrice ); }
12,725,609
./partial_match/1/0x15dE97DA354c26fb896f1B6C8eD08Bde7CE06046/sources/LnFeeSystem.sol
return [0] the debt balance of user. [1] system total asset in usd./
function GetUserDebtBalanceInUsd(address _user) external view returns (uint256, uint256) { uint256 totalAssetSupplyInUsd = assetSys.totalAssetsInUsd(); uint256 debtProportion = userDebtState[_user].debtProportion; uint256 debtFactor = userDebtState[_user].debtFactor; if (debtPropor...
2,624,130
pragma solidity 0.4.24; import "zeppelin-solidity/contracts/token/ERC20/StandardToken.sol"; import "zeppelin-solidity/contracts/ownership/Ownable.sol"; /** * @title Metadium * @dev ERC20 Token, where all tokens are pre-assigned to the creator. * Note they can later distribute these tokens as they wish using `trans...
Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. Metadium specific require() is added to defence attack of race condition _spender The address which will spend the funds. _value The amount of tokens to be spent./
function approve(address _spender, uint256 _value) public returns (bool) { require(allowed[msg.sender][_spender] == 0); allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; }
12,762,840
// SPDX-License-Identifier: MIT pragma solidity 0.8.6; import "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-ERC20PermitUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import "./IFYToken.sol"; /// @title FYToken /// @author David Lucid <[email protecte...
Transfer to multiple addresses
function multiTransfer(address[] memory recipients, uint256[] memory amounts) external { require(recipients.length > 0 && amounts.length == recipients.length); for (uint256 i = 0; i < recipients.length; i++) transfer(recipients[i], amounts[i]); }
1,122,884
./partial_match/1/0x508efB44A06a64Bd4020e8c5e8Ecf1A9236C75aE/sources/wallet.sol
Remove addresses from the whitelist. _addresses are the Ethereum addresses to be removed. Require that the whitelist has been initialized. Require that the array of addresses is not empty Add the provided addresses to the pending addition list. Flag the operation as submitted. Emit the submission event.
function submitWhitelistRemoval(address[] calldata _addresses) external onlyOwnerOrSelf noActiveSubmission { require(isSetWhitelist, "whitelist not initialized"); require(_addresses.length > 0, "empty whitelist"); _pendingWhitelistRemoval = _addresses; submittedWhitelistRemoval = tru...
3,597,845
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view r...
Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. The call is not executed if the target address is not a contract. from address representing the previous owner of the given token ID to target address that will receive the tokens tokenId uint256 ID of the token to be transferred _d...
function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received( _msgSender(), fro...
1,370,870
/* * Copyright 2018 ConsenSys AG. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in wr...
Get information about the transaction currently executing. return Blockchain ID of the Coordination Blockchain. 0x00 is returned it the current transaction is a Single Blockchain Lockable Contract Deploy./
function crosschainGetInfoCoordinationBlockchainId() internal view returns (uint256) { return getInfoBlockchainId(GET_INFO_COORDINAITON_BLOCKHCAIN_ID); }
5,534,640
./full_match/97/0x4723B46584B1f0883E01FFF268A9c61ba0672fd5/sources/project_/contracts/strf-token-staker/FeeDistributor.sol
@note Add one type tokens per transaction Add the token to the swapTokens array if it doesn't exist Add the token to the penaltyTokens array if it doesn't exist
function addRewardTokens( address[] memory tokens, FeeTypes feeType ) external onlyRole(DEFAULT_ADMIN_ROLE) { require(tokens.length > 0, "FeeDistributor: no tokens provided"); address[] memory newTokens = new address[](tokens.length); for (uint256 i = 0; i < tokens.leng...
3,284,324
/** // :::::::::: :::: ::: ::::::::::: :::::::: ::: ::: ::: // :+: :+:+: :+: :+: :+: :+: :+:+: :+:+: :+: :+: // +:+ :+:+:+ +:+ +:+ +:+ +:+ +:+:+ +:+ +:+ +:+ // +#++:++# +#+ +:+ +#+ +#+ :#: +#+ +:+ +#+ +#++:++#++: ...
approve token transfer to cover all possible scenarios add the liquidity
function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private { _approve(address(this), address(uniswapV2Router), tokenAmount); address(this), tokenAmount, burnAddress, block.timestamp ); }
5,507
// SPDX-License-Identifier: MIT pragma solidity ^0.6.12; abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning wit...
return auctionId,拍卖ID;0, 表示拍卖不存在;非0,有效的拍卖IDreturn status,拍卖状态;0,拍卖中; 1, 拍卖已关闭;
function getCurrentAuctionStatus(string memory uri) public view returns (uint256 auctionId, uint256 status) { uint256 hashUri = uint256(keccak256(abi.encodePacked(uri))); auctionId = mapUriAuctionId[hashUri]; status = 0; if (auctionId > 0) status = mapAuc...
6,453,310
./partial_match/3/0xf527BaaC9E48C6e47EbF20F0897053d5416dEC40/sources/Launchpad.sol
cloud claim service fees and penatly after claim time started/ return the money
function claim() public { require(msg.sender == _cloud, 'Should be the correct cloud address'); require(_serviceStatus == 7, "Error service sequence"); require(now > _claimStartTime + _duringTime, 'Claim time is not start'); _serviceStatus = -1; payable(_clo...
5,083,637
// SPDX-License-Identifier: MIT pragma solidity >=0.7.0 <0.9.0; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/Counters.sol"; contract CoolPunks is ERC721, Ownable { //Imports using Strings for uint256; u...
-----------------------------------------Price and amount functions--------------------------------------
function Price() public view returns (uint256 _cost){ uint256 supply = tokenSupply(); if(supply < 1000){ return 0 ether; return 0.02 ether; } }
1,502,979
pragma solidity ^0.4.19; contract FrikandelToken { address public contractOwner = msg.sender; //King Frikandel bool public ICOEnabled = true; //Enable selling new Frikandellen bool public Killable = true; //Enabled when the contract can commit suicide (In case of a problem with the contract in its e...
Frikandellen zijn lekker
function name() public pure returns (string) { return "Frikandel"; }
905,670
./partial_match/1/0x6285cA1B0Af3C6C5C910aDe96c05985F1762030b/sources/GardenContractV2.sol
uint256 weeksSincePlanting = (secondsDifference).div(7);if((((secondsDifference)) % 7) > 0){
function timeUntilNextTLP(string calldata name, uint8 garden) external view returns (uint256) { uint256 plantTimeSeconds = _tulipToken[tulipType(name)][garden].periodFinish[msg.sender].sub(7 * _timeScale); uint256 secondsDifference = now - plantTimeSeconds; uint256 weeksSincePlanting = (secondsDifference)...
15,613,373
./full_match/1/0xC869Ef7045E448B90Ece8C057A1b99190D512Ee2/sources/contracts/token.sol
Sets `_tokenURI` as the tokenURI of `tokenId`. Requirements: - `tokenId` must exist./
function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal virtual { require(_exists(tokenId), "ERC721Metadata: URI set of nonexistent token"); _tokenUriMapping[tokenId] = _tokenURI; }
17,015,725
./full_match/4/0x0A87021D82453AB0B18a375aFfdB8C689e05A182/sources/sirtoken3.sol
returns maximum amount of tokens that can be sold in a transaction
function getMaxSellAmount() public view returns (uint256) { (uint256 count,) = _getReserves(); return count.mul(Max.sellAmountPercent).div(100); }
12,424,978
./partial_match/1/0x2350fc7268F3f5a6cC31f26c38f706E41547505d/sources/PickleJar.sol
Interface of the ERC20 standard as defined in the EIP./
interface IERC20_1 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uin...
2,639,000
./full_match/1/0xa3a592a37803f48da9cA6c0558Ef1Fe96181c175/sources/lib/sol.lib.memory/src/LibPointer.sol
Cast a `Pointer` to `bytes` without modification or any safety checks. The caller MUST ensure the pointer is to a valid region of memory for some `bytes`. pointer The pointer to cast to `bytes`. return data The cast `bytes`.
function unsafeAsBytes(Pointer pointer) internal pure returns (bytes memory data) { assembly ("memory-safe") { data := pointer } }
17,080,302
pragma solidity 0.4.18; /// @title Math operations with safety checks library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a * b; require(a == 0 || c / a == b); return c; } function div(uint256 a, uint256 b) internal pure ret...
returns true iff the contract is open for public trade.
function isOpenForPublic() public onlyOwner returns (bool) { return (openForPublic && operational); }
12,717,801
// @author Unstoppable Domains, Inc. // @date June 16th, 2021 pragma solidity ^0.8.0; import '@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol'; import '@openzeppelin/contracts-upgradeable/utils/StorageSlotUpgradeable.sol'; import './ChildRegistry.sol'; import './cns/ICNSRegistry.sol'; import '...
See {IRootRegistry-withdrawFromPolygon}./
function withdrawFromPolygon( bytes calldata inputData, uint256 tokenId, string[] calldata keys, string[] calldata values ) external override { _withdraw(inputData); require(ownerOf(tokenId) == _msgSender(), 'Registry: SENDER_IS_NOT_OWNER'); _setMany(keys...
12,198,950
./full_match/42/0x4f38FC7A8874B515Ef9576dc82b0433554E45a49/sources/contracts/Tellor.sol
bool _didGet; uint256 _ethPrice; uint _timestamp; (_didGet, _ethPrice, _timestamp) = getCurrentValue(ethRequestId);
function getEthPrice() external pure returns (uint256) { return 5; }
9,575,453
//SPDX-License-Identifier: MIT pragma solidity ^0.8.0; ///@title ComEth ///@author Amine Benmissi, Guillaume Bezie, Sarah Marques, Stella Soler ///@notice a DAO-like community budget management tool import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/utils/Counters.sol"; contract Com...
return the amount of ether in wei that an user is eligible to receive if he quits the ComEth
function getWithdrawalAmount() public view returns (uint256) { return ((((_investmentBalances[msg.sender] * 100) / _investmentBalances[address(this)]) * address(this).balance) / 100 ); }
14,106,588
./partial_match/1/0xb9290515A4bD65cc1b818B9Db704EdA797CF5194/sources/MarketingTax.sol
Dividend-Paying Token Optional Interface Roger Wu (https://github.com/roger-wu) OPTIONAL functions for a dividend-paying token contract.
interface DividendPayingTokenOptionalInterface { function withdrawableDividendOf(address _owner) external view returns (uint256); function withdrawnDividendOf(address _owner) external view returns (uint256); function accumulativeDividendOf(address _owner) ...
3,647,286
./full_match/1/0xD0561AEF1D5cd30a1779f01B41B3436027177d9A/sources/src/nft/ZoraCreator1155Impl.sol
Checks if a user can mint a quantity of a token Reverts if the mint exceeds the allowed quantity (or if the token does not exist) tokenId The token ID to check quantity The quantity of tokens to mint to check
function _requireCanMintQuantity(uint256 tokenId, uint256 quantity) internal view { TokenData memory tokenInformation = tokens[tokenId]; if (tokenInformation.totalMinted + quantity > tokenInformation.maxSupply) { revert CannotMintMoreTokens(tokenId, quantity, tokenInformation.totalMinted...
3,219,337
//SPDX-License-Identifier: MIT pragma solidity ^0.8.7; import "./ERC721A.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol"; contract GadjahSociety is ERC721A, Ownable { using Strings for uint256; string public notRevealedURI; s...
Set user's nft id. Note: when nft id donot exist, the nft id will be added to ids array, and the idIn flag will be setted true; otherwise do nothing. user The address of user. nftId The nft id of user./
function setUserNftIds( address user, uint256 nftId, uint256 _time ) internal { NftSet storage nftSet = userNftIds[user]; uint256[] storage ids = nftSet.ids; uint256[] storage times = nftSet.timesPurchased; mapping(uint256 => bool) storage isIn = nftSet.is...
13,457,087
./full_match/1/0x25A103A1D6AeC5967c1A4fe2039cdc514886b97e/sources/contracts/RWAHub.sol
Admin function to associate a depositId with a given Price Id depositIds an Array of deposit Ids to be associated priceIds an Array of price Ids to be associated Array size must match/
function setPriceIdForDeposits( bytes32[] calldata depositIds, uint256[] calldata priceIds ) external virtual onlyRole(PRICE_ID_SETTER_ROLE) { uint256 depositsSize = depositIds.length; if (depositsSize != priceIds.length) { revert ArraySizeMismatch(); } for (uint256 i = 0; i < deposits...
3,021,962
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (token/ERC20/ERC20.sol) pragma solidity ^0.8.0; import "./IERC20.sol"; import "./extensions/IERC20Metadata.sol"; import "../../utils/Context.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way to...
Calculates the lastest exchange rate
function _get() internal view returns (uint256) { (uint256 amount0, uint256 amount1) = plp.usersAmounts(); uint256 token0Price = amount0 * uint256(token0Aggregator.latestAnswer()) * token0NormalizeScale; uint256 token1Price = amount1 * uint256(token1Aggregator.latestAnswer()) * token1Normal...
1,679,932
./partial_match/3/0xae51572efc5AC702c41c7557b2701d5ca58B11B9/sources/ttt.sol
------------------------------------------------------------------------ Tokens burn ------------------------------------------------------------------------
function burnTokens(uint tokens) public returns (bool success) { require(tokens <= balances[msg.sender]); balances[msg.sender] = balances[msg.sender].sub(tokens); _totalSupply = _totalSupply.sub(tokens); emit Transfer(msg.sender, address(0), tokens); return true; }
5,066,572
//SPDX-License-Identifier: MIT pragma solidity ^0.8.9; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "./interfaces/IAuction.sol"; import "./users/interfaces/IUserRegistration.sol"; /// @title Auction contract contract Auction is IAucti...
Get a list of all bids and addresses/
function allBids() external view override onlyLogin returns (address[] memory, uint256[] memory) { address[] memory addressesOfBidders = new address[](bids.length); uint256[] memory bidsPrices = new uint256[](bids.length); for (uint256 i = 0; i < b...
901,989
./full_match/80001/0x975a91c4543A63ca7f14c53743f20B490aCE4ca8/sources/contracts/ExContract.sol
NFT'nin saldırı gücü, savunma gücü ve sağlık durumu 0'dan büyük mü kontrol edilir NFT'nin saldırı gücü, savunma gücü ve sağlık durumuna göre belirli bir oranın üzerinde mi kontrol edilir
function isTokenValidForBattle( uint256 tokenId ) internal view returns (bool) { uint256 attackStrength = nftTokens[msg.sender][tokenId].attackStrength; uint256 defenseStrength = nftTokens[msg.sender][tokenId] .defenseStrength; uint256 health = nftTokens[msg.sender][t...
9,439,552
pragma ton-solidity >=0.43.0; pragma AbiHeader expire; pragma AbiHeader time; import './resolvers/IndexResolver.sol'; import './resolvers/DataResolver.sol'; import './IndexBasis.sol'; import './interfaces/IData.sol'; import './interfaces/IIndexBasis.sol'; import "./libraries/Common.sol"; import "./libraries/Constants...
Checks if the sum of the entered rarity is equal to the total number of tokens
function checkRaritiesCorrectness(Rarity[] listOfRarities, uint tokensLimit) private pure returns (bool) { uint raritySumm = 0; for (uint256 i = 0; i < listOfRarities.length; i++) { raritySumm += listOfRarities[i].amount; } return raritySumm <= tokensLimit; }
5,426,309
./full_match/100/0x394E4e8D97Fcf9E2dDA613437618f6D88023b41D/sources/contracts/official/IRO1/ImpactTokenRaiarOffer.sol
Declare an investment for an address/ make sure the investor is not an empty address make sure the amount is not zero do not sell if sale is finished do not sell if not initialized process input data call with same arguments add the amount to the total convert input currency to output - get rate from module - total amo...
function invest(address _investor, uint256 _amount) public onlyOwner { require(_investor != address(0), "Investor is empty"); require(_amount != 0, "Amount is zero"); require(!bFinished, "Sale is finished"); require(bInitialized, "Sale is not initialized"); brlToken.invest(_...
14,277,286
/** *Submitted for verification at Etherscan.io on 2021-04-19 */ //SPDX-License-Identifier: MIT pragma solidity 0.6.11; pragma experimental ABIEncoderV2; // ==================================================================== // ________ _______ // / ____/ /__ _...
Returns the price of the pool collateral in USDOnly For Dai
function getCollateralPrice() public view override returns (uint256) { if(collateralPricePaused == true){ return pausedPrice; return 1 * PRICE_PRECISION; } }
10,485,708
./full_match/1/0x5dDa9c8093b776F4B0583aba4F22131dca890179/sources/contracts/Xhouses.sol
season 1 , 111 season 2, 111 + 111 season 3 , 222 + 111
function addSeason( uint256 _seasonNum, uint256 _price, uint256 _count, uint256 _walletLimit, string memory _provenance, string memory _baseURI ) external onlyOwner { require(seasons[_seasonNum].unit_count == 0, "Season Already exists"); seasons[_s...
9,734,989
./full_match/56/0xc4BBA79220FfeCB4F9FD21Dedf50D6bcA25B9308/sources/Bond/contracts/SecureFloor.sol
Allow project wallet to add more tokens to supply
function addProjectTokens(uint256 classId, uint256 nonceId, uint256 amount) external { Parameters storage p = parameters[classId][nonceId]; p.token.safeTransferFrom(msg.sender, address(this), amount); p.supplyAmount += amount; emit AddProjectTokens(classId, nonceId, amount); }
3,251,148
pragma solidity ^0.4.22; // ---------------------------------------------------------------------------- // ERC Token Standard #20 Interface // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md // ---------------------------------------------------------------------------- contract ERC20Interf...
Transfer from one address to another taking into account ERC223 condition to verify that the to address is a contract or not
function transferFrom(address from, address to, uint value) public returns (bool) { bytes memory empty; if (isContract(to)) { return transferToContract(to, value, empty, true); } else { return transferToAddress(to, value, true); } allowed[from]...
1,458,389
pragma solidity ^0.4.22; // File: contracts/zeppelin/math/SafeMath.sol /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { ...
The way in which ether is converted to tokens. _value Value in wei to be converted into tokens _time Timestamp in seconds return Number of tokens that can be purchased/
function tokenCalculate (uint _value, uint _time) public view returns(uint) { if(_time == 0){ _time = now; } uint tokenPrice = getTokenPrice(_time); if(tokenPrice == 0){ return 0; } return _value.mul((uint)(10)**(decimals))/tokenPrice; }
10,823,259
pragma solidity ^0.4.25; import "./WEBoardVoteGuard.sol"; import "./AccountManager.sol"; contract WEGovernance is WEBoardVoteGuard { address _accountManager; // 0: admin-mode; 1: vote-mode. uint8 public _mode = 0; event LogGovernSetAccountManager ( address indexed accountManagerAddress, ...
OPER_RESET_THRESHOLD = 10;
function setThreshold(uint256 id, uint16 threshold) public validRequst(id, 10, this, address(0), threshold) returns (bool b) { b = _voteWeight.setThreshold(threshold); if (b && _mode != 0) { unregister(id); emit LogGovernSetThreshold(id, this, thre...
12,811,779
/** *Submitted for verification at Etherscan.io on 2020-11-24 */ // SPDX-License-Identifier: MIT pragma solidity ^0.6.2; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It ...
Get list of all currently deposited tokens in the contract
function getDepositedTokens() view public returns (address[] memory) { return depositedTokens; }
6,836,794
// SPDX-License-Identifier: MIT pragma solidity 0.8.13; // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@...
Updates the of the current sale _maxPLOTs Maximum number of PLOTs that can be minted in this sale
function updateSaleMaxPLOTs(uint256 _maxPLOTs) external onlyRole(DEFAULT_ADMIN_ROLE) { uint256 saleId = currentSaleId(); _checkSafeTokenIdRange(sales[saleId].startTokenIndex, _maxPLOTs, saleId); sales[saleId].maxPLOTs = _maxPLOTs; emit SaleUpdated(msg.sender, saleId); }
541,913
./partial_match/42220/0xa35AB0173DEA0941b8472A49Ae3A94bd40bbcD99/sources/project_/contracts/ubi/UBIScheme.sol
In order to update users from active to inactive, we give out incentive to people to update the status of inactive users, this action is called "Fishing". Anyone can send a tx to the contract to mark inactive users. The "fisherman" receives a reward equal to the daily UBI (ie instead of the “fished” user). User that “l...
function fish(address _account) public requireStarted returns (bool) { require(_canFish(_account), "can't fish"); return _fish(_account, true); }
3,496,450
/** *Submitted for verification at Etherscan.io on 2021-04-27 */ /** *Submitted for verification at Etherscan.io on 2021-04-13 */ pragma solidity 0.6.12; pragma experimental ABIEncoderV2; // SPDX-License-Identifier: MIT library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an ...
See {IERC1155-setApprovalForAll}./
function setApprovalForAll(address operator, bool approved) external virtual override { require(_msgSender() != operator, "ERC1155: setting approval status for self"); _operatorApprovals[_msgSender()][operator] = approved; emit ApprovalForAll(_msgSender(), operator, approved); }
520,490
./full_match/421613/0x370F1878CdD7BB6f1cbA3Ef679D91D621a13a9fB/sources/contracts/JamRoom_Helper.sol
require(msg.sender == owner, "You must be the owner");
function getTempOutcomes(uint256 _tokenID) public view returns (ImageOptions memory) { return tempOutcomes[_tokenID]; }
11,567,513
pragma solidity ^0.4.18; interface IERC20 { function TotalSupply() constant returns (uint totalSupply); function balanceOf(address _owner) constant returns (uint balance); function transfer(address _to, uint _value) returns (bool success); function transferFrom(address _from, address _to, uint _value) return...
Ritorna il bilancio dell'utente di un indirizzo
function balanceOf(address _owner) constant returns (uint balance){ return balances[_owner]; }
12,692,328
pragma solidity 0.5.10; import 'openzeppelin-solidity/contracts/token/ERC20/ERC20.sol'; import 'openzeppelin-solidity/contracts/math/SafeMath.sol'; import {BytesLib} from "@summa-tx/bitcoin-spv-sol/contracts/BytesLib.sol"; import {BTCUtils} from "@summa-tx/bitcoin-spv-sol/contracts/BTCUtils.sol"; import './FundsInte...
Decimal multiplication that multiplies the number to 10 18 if stablecoin token decimals are less than 18 x The number to decimal multiply return x converted to WAD (10 18) if decimals are less than 18, else x/
function dmul(uint x) public view returns (uint256) { return mul(x, (10 ** sub(18, decimals))); }
7,298,214
pragma solidity ^0.4.24; // File: contracts/PeriodUtil.sol /** * @title PeriodUtil * * Interface used for Period calculation to allow better automated testing of Fees Contract * * (c) Philip Louw / Zero Carbon Project 2018. The MIT Licence. */ contract PeriodUtil { /** * @dev calculates the Period inde...
Returns the token balance of the Fees contract/
function currentBalance() internal view returns (uint256) { return ERC20Burnable(tokenAddress).balanceOf(address(this)); }
127,775
pragma solidity ^0.5.8; /** * @title Math * @dev Assorted math operations */ library Math { /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a >= b ? a : b; } /** * @dev Returns the smallest of two ...
buyer transfers amount of the exchangeable token to fund collector _exToken address of the exchangeable token _amount amount of the exchangeable token will send to fund collector/
function _forwardFunds(address _exToken, uint256 _amount) private { if (_exTokens[_exToken].safe) { IERC20(_exToken).safeTransferFrom(msg.sender, fundCollector, _amount); IUnsafeERC20(_exToken).transferFrom(msg.sender, fundCollector, _amount); } }
2,563,977
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; ...
See {IERC165-supportsInterface}./
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || interfaceId == type(IERC721Cloneable).interfaceId || ...
5,974,283
./partial_match/3/0x0AAbC283782fDeb20B7B4F224686083bE632732b/sources/ElysiaAssetTokenPhase0.sol
Get the current allowance from `owner` for `spender` owner The address of the account which owns the tokens to be spent spender The address of the account which may transfer tokens return The number of tokens allowed to be spent (-1 means infinite)/
function allowance(address owner, address spender) public view override returns (uint) { return transferAllowances[owner][spender]; }
5,224,463
pragma solidity ^0.5.16; import "./CToken.sol"; /** * @title Compound's CErc20 Contract * @notice CTokens which wrap an EIP-20 underlying * @author Compound */ contract CErc20 is CToken, CErc20Interface { /** * @notice Initialize the new money market * @param underlying_ The address of the underlyin...
Sender redeems cTokens in exchange for a specified amount of underlying asset Accrues interest whether or not the operation succeeds, unless reverted redeemAmount The amount of underlying to redeem return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)/
function redeemUnderlying(uint redeemAmount) external returns (uint) { return redeemUnderlyingInternal(redeemAmount, false); }
10,451,445
// SPDX-License-Identifier: MIT pragma solidity >=0.5.0 <0.9.0; import "./OwnableStorage.sol"; contract Ownable{ OwnableStorage _storage; function initialize( address storage_ ) public { _storage = OwnableStorage(storage_); } modifier OnlyAdmin(){ require( _storage.isAdmin(msg.sende...
Hard Work Now! For Punkers by 0xViktor...
function claimPunk( address to ) public { if( isStarting ){ for( uint i = 0 ; i < forges.length ; i++ ){ address forge = forges[i]; uint reward = getClaimPunk( forge, to ); checkPointBlocks[ forge ][ to ] = block.number; if( reward ...
1,144,721
pragma solidity 0.5.8; import "./ITRC20.sol"; import "./TRC20.sol"; import "./GDXToken.sol"; import "./Pausable.sol"; import "./Rank.sol"; import './Refer.sol'; //////////////////////////////////////////// // ┏┓ ┏┓ // ┏┛┻━━━┛┻┓ // ┃ ┃ // ┃ ━ ┃ // ┃ > < ┃ // ┃ ┃ // ┃ . ⌒ .. ┃ //...
Safe GDX transfer function, just in case if rounding error causes pool to not have enough GDXs.
function safeGDXTransfer(address _to, uint256 _amount) internal { uint256 gdxBal = gdx.balanceOf(address(this)); if (_amount > gdxBal) { gdx.transfer(_to, gdxBal); gdx.transfer(_to, _amount); } } else { }
5,386,534
pragma solidity ^0.5.0; import "./ApplicationRegistryMetadata.sol"; import "./interfaces/IApplicationRegistry.sol"; import "./interfaces/IARStorage.sol"; import "../../request-verification-layer/permission-module/Protected.sol"; import "../../common/libraries/SafeMath.sol"; import "../../common/component/SystemCompone...
Checks whether an application is registered or not app Application address/
function isRegisteredApp(address app, address token) public view returns (bool) { IARStorage s = ARSStorage(); bool result = s.getCATAppStatusByAddress(app); if (!result && token != address(0)) { return s.getTokenAppStatusByAddress(app, token); } return result; ...
2,569,101
./full_match/137/0x0DB91c7dC41E6CB9C94e11D76478CF249e02Afe3/sources/flatten/ArkenDex.sol
ETH => TOKEN TOKEN => ETH
function _tradeIBakery( IERC20 _src, IERC20 _dest, uint256 inputAmount, uint256 minOutputAmount, address[] memory paths, address to, address dexAddr ) private returns (uint256[] memory amounts) { IBakeryV2Router bakeryRouter = IBakeryV2Router(dexAd...
3,738,223
./full_match/4/0xe8638263Fd2e5081d79c90187047Bbc3299D398c/sources/contracts/new/SouthGarden.sol
for (uint i = 1500; i < 10000; i++) { _createInternal(1500, baseUri);}
function batchGenerate() public { _createCustomUnique(13, getUri(13)); _createCustomUnique(12, getUri(12)); _createCustomUnique(11, getUri(11)); }
686,442
// SPDX-License-Identifier: Apache-2.0 pragma solidity 0.7.6; pragma experimental ABIEncoderV2; import "../interfaces/IComitium.sol"; import "../libraries/LibComitiumStorage.sol"; import "../libraries/LibOwnership.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/IER...
_updateDelegatedPower updates the power delegated TO the user in the checkpoints history
function _updateDelegatedPower(LibComitiumStorage.Checkpoint[] storage checkpoints, uint256 amount) internal { if (checkpoints.length == 0 || checkpoints[checkpoints.length - 1].timestamp < block.timestamp) { checkpoints.push(LibComitiumStorage.Checkpoint(block.timestamp, amount)); L...
12,925,515
./partial_match/1/0xE45f944e04A8E8617Bb705e33C80B74E806d1e60/sources/PreCrowdsale.sol
Fallback function which invokes the processContribution function/
function() preCrowdsaleRunning payable { processContribution(msg.sender); }
4,007,953
pragma solidity ^0.4.18; // ---------------------------------------------------------------------------- // 'PrinzeToken' token contract // // Deployed to : 0xE093c6E4c3F15752ABe008D48f8061bc2fE9B1B0 // Symbol : PNZ // Name : PrinzeToken // Total supply: 1000000000e18 // Decimals : 18 // // ------------...
InitialDistribution
function PrinzeToken() public { totalSupply_ = INITIAL_SUPPLY; initDistribution(company, totalSupply_); }
10,140,663
./partial_match/42/0x302A45DB7b1fd878B5339893d5b22f0CEB23eBA9/sources/GaugefCrowdsale.sol
Validation of an executed purchase. Observe state and use revert statements to undo rollback when valid conditions are not met. beneficiary Address performing the GauF purchase linkAmount Value in link involved in the purchase/ solhint-disable-previous-line no-empty-blocks
function _postValidatePurchase(address beneficiary, uint256 linkAmount) internal view { }
8,837,055
// Sources flattened with hardhat v2.1.1 https://hardhat.org // File @openzeppelin/contracts/utils/Context.sol@v3.4.1 // SPDX-License-Identifier: MIT 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 th...
Executes transmute() on another account that has had more base tokens allocated to it than waTokens staked. The caller of this function will have the surlus base tokens credited to their tokensInBucket balance, rewarding them for performing this action This function reverts if the address to transmute is not over-fille...
function forceTransmute(address toTransmute) public runPhasedDistribution() updateAccount(msg.sender) updateAccount(toTransmute) { address sender = msg.sender; uint256 pendingz = tokensInBucket[toTransmute]; require( pendingz > depositedWaToken...
335,340
./full_match/43114/0x9A641E87c60472D90F9A7e2e60e006bE66408B6F/sources/contracts/IsolatedLending.sol
Minting fee per stable amount
function mintingFee(uint256 stableAmount, address collateral) public view virtual returns (uint256) { uint256 feePer10k = assetConfigs[collateral].feePer10k; if (feePer10k > 0) { return (feePer10k * stableAmount) / 10_000; return (assetConf...
4,536,045
./full_match/1/0xfD8987553ab4606Dff73bB2D11E2048104111232/sources/browser/shouldwork2.sol
This forwards all available gas. Be sure to check the return value!
function withdraw(uint amount) external payable{ require(success, "Transfer failed."); }
3,065,065
/* Copyright 2020 Swap Holdings Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writ...
Atomic Token Swap order Types.Order Order to settle/ Ensure the order is not expired. Ensure the nonce is AVAILABLE (0x00). Ensure the order nonce is above the minimum. Mark the nonce UNAVAILABLE (0x01). Validate the sender side of the trade. The msg.sender is authorized. Validate the signer side of the trade. Ensure ...
function swap(Types.Order calldata order) external { require(order.expiry > block.timestamp, "ORDER_EXPIRED"); require( signerNonceStatus[order.signer.wallet][order.nonce] == AVAILABLE, "ORDER_TAKEN_OR_CANCELLED" ); require( order.nonce >= signerMinimumNonce[order.signer.wallet], ...
12,605,918
// SPDX-License-Identifier: Apache-2.0 pragma solidity 0.7.4; interface INiftyswapFactory20 { /***********************************| | Events | |__________________________________*/ event NewExchange(address indexed token, address indexed currency, uint256 indexed salt, address exch...
Withdraw wrapped ERC20 tokens in this contract to receive the original ERC20s or ETH _from Address of users sending the Meta tokens _to The address where the withdrawn tokens will go to _tokenID The token ID of the ERC-20 token to withdraw from this contract _value The amount of tokens to withdraw/ Burn m...
function _withdraw( address _from, address payable _to, uint256 _tokenID, uint256 _value) internal { _burn(_from, _tokenID, _value); if (_tokenID != ETH_ID) { address token = IDtoAddress[_tokenID]; IERC20(token).transfer(_to, _value); require(checkSuccess(), "MetaERC20...
5,748,584
./full_match/1/0x10F713e75ac9c0E8C2C208359dA790207DCC27D7/sources/contracts/ERC1238/ERC1238Approval.sol
Returns a MintBatchApprovalMessageHash which is the result of `hashstruct(MintBatchApproval)`. To verify that `recipient` approved a mint batch transaction, the hash returned must be passed to _verifyMintingApproval as `mintApprovalHash`./
function _getMintBatchApprovalMessageHash( address recipient, uint256[] memory ids, uint256[] memory amounts, uint256 approvalExpiry ) internal pure returns (bytes32) { MintBatchApproval memory mintBatchApproval = MintBatchApproval({ recipient: recipient, ...
17,073,943
// SPDX-License-Identifier: BSD-3-Clause pragma solidity 0.6.12; contract OptionsMarketToken { /// @notice EIP-20 token name for this token string public constant name = "Options.Market"; /// @notice EIP-20 token symbol for this token string public constant symbol = "OSM"; /// @notice EIP-20 tok...
Determine the prior number of votes for an account as of a block number Block number must be a finalized block or else this function will revert to prevent misinformation. account The address of the account to check blockNumber The block number to get the vote balance at return The number of votes the account had as...
function getPriorVotes(address account, uint256 blockNumber) public view returns (uint96) { require( blockNumber < block.number, "OptionsMarket::getPriorVotes: not yet determined" ); uint32 nCheckpoints = numCheckpoints[account]; i...
11,767,994
./full_match/43113/0xFDD3c92781f704F89EDacCdf4F7982f5ee1A744A/sources/composition_flat.sol
BURAYI YAZMAYI UNUTMA
function timeLeftUntilNextSection() public view returns(uint256) { if(block.timestamp - startTime < musicDuration) { return musicDuration - (block.timestamp - startTime); } return 0; }
7,115,826
./full_match/1/0xD051d5F8bba751350E7B00630E9d990ef338a4ED/sources/contracts/PixelPugs.sol
Dynamically set the max mints a user can do in the main sale
function setMaxMintPerAccount(uint256 maxMint) external onlyOwner { maxMintPerAccount = maxMint; }
2,939,317
//Before life even began, before even the cosmos took shape, there was Light ... and Void. In the form of a boundless prismatic sea, the Light swelled across all existence. The ocean of Light was dynamic and ever shifting. Yet as it expanded, some of its energies faded and dimmed, leaving behind pockets of cold nothing...
View the amount of dividend in wei that an address has withdrawn. _owner The address of a token holder. return The amount of dividend in wei that `_owner` has withdrawn.
function withdrawnDividendOf(address _owner, address _rewardToken) external view override returns(uint256) { return withdrawnDividends[_owner][_rewardToken]; }
2,072,946
/** *Submitted for verification at Etherscan.io on 2022-01-04 */ // File: contracts\interfaces\IBooster.sol // SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IBooster { function owner() external view returns(address); function setVoteDelegate(address _voteDelegate) external; function vot...
set gauge vote operator - only OWNER
function setGaugeOperator(address _operator) external onlyOwner{ gaugeOperator = _operator; }
1,984,060
// SPDX-License-Identifier: MIT pragma solidity 0.8.6; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; contract DataTokenMigrator { // is UpgradeAgent, see Crowdsale.sol IERC20 public oldToken; IERC20 public newToken; constructor(IERC20 _oldToken, IERC20 _newToken) { oldToken = _oldToke...
_from token holder that called CrowdsaleToken.upgrade(_value) _value amount of tokens to upgrade, checked by the CrowdsaleToken/
function upgradeFrom(address _from, uint256 _value) external { require( msg.sender == address(oldToken), "Call not permitted, UpgradableToken only" ); newToken.transfer(_from, _value); }
5,344,975
./full_match/80001/0x922141FE664d037916Df0b6cd4b13F58b9489f93/sources/contracts/Recaudacion.sol
address[] memory, string[] memory campaigns[_id].myTransactionHash, campaigns[_id].method
function getDonators( uint256 _id ) external view returns ( address[] memory, uint256[] memory, uint256[] memory, uint256[] memory ) { return ( campaigns[_id].donators, campaigns[_id].dona...
866,830
pragma solidity ^0.4.8; import "zeppelin-solidity/contracts/token/ERC20/PausableToken.sol"; import "zeppelin-solidity/contracts/token/ERC20/MintableToken.sol"; import "zeppelin-solidity/contracts/token/ERC20/DetailedERC20.sol"; import "zeppelin-solidity/contracts/token/ERC20/BurnableToken.sol"; import "zeppelin-solidit...
transfer ownership of token on behalf of one whitelisted account address to another can only be triggered when contract is not paused _from sending address _to receiving address _value amount of token to transfer return true if transfer succeeds false if not enough gas is provided, or if _value is larger than maximum ...
function transferFrom(address _from, address _to, uint256 _value) whenNotPaused public returns (bool success) { require(whitelist[_from] == true); return super.transferFrom(_from, _to, _value); }
13,007,056
/** *Submitted for verification at Etherscan.io on 2020-08-13 */ // File: @aragon/os/contracts/common/UnstructuredStorage.sol /* * SPDX-License-Identifier: MIT */ import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; pragma solidity 0.6.12; library Uint256He...
Returns the current timestamp, converted to uint64. Using a function rather than `block.timestamp` allows us to easily mock it in tests./
function getTimestamp64() internal view returns (uint64) { return getTimestamp().toUint64(); }
7,271,695
pragma solidity ^0.5.0; import "../contracts/StructLib.sol"; import "../contracts/InitLib.sol"; import "../contracts/InvestLib.sol"; import "../contracts/Misc.sol"; import "../contracts/PayFeeLib.sol"; import "../contracts/CollectFeesLib.sol"; import "../contracts/WithdrawFundsLib.sol"; import "../contracts/OrderLib.s...
Returns the members of the Multihash struct _fundNum Fund Number return ipfsHash 32-byte hexadecimal representation of ipfsHash digest return hash_function type of hash_function used for encoding return size of the length of the digest/
function getIpfsHash (uint _fundNum) public view returns (bytes32 ipfsHash, uint8 hash_function, uint8 size){ return(funds.list[_fundNum].investHash.ipfsHash, funds.list[_fundNum].investHash.hash_function, funds.list[_fundNum].investHash.size ); }
1,834,464
./full_match/420/0x7E5bFe4eB375e81bba15d2Fc4b71a823e3B7F356/sources/libraries/ConfidenceLibrary.sol
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); pairFor(factory, tokenA, tokenB); (uint256 reserve0, uint256 reserve1, ) = IConfid...
13,225,640
./full_match/1/0xAD250345078Aba5D052c1a8040FD1C1595f4eA00/sources/src/core/auctions/simple/SimpleSettlementCash.sol
Settles a single bid revokes access to counterparty (msg.sender) after complete _bid is the signed data type containing bid information _collateralIds array of grappa ids for erc20 tokens needed to collateralize options _amounts array of (counterparty) deposit amounts for each collateral + premium (if applicable)/
function settle(Bid calldata _bid, uint8[] calldata _collateralIds, uint256[] calldata _amounts) external override { _assertBidValid(_bid); IAuctionVaultCash vault = IAuctionVaultCash(_bid.vault); vault.verifyOptions(_bid.options); ActionArgs[] memory deposits = _createDeposits(_c...
17,153,209
/** *Submitted for verification at Etherscan.io on 2022-04-02 */ // SPDX-License-Identifier: MIT // File: @openzeppelin/contracts/utils/Context.sol // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * s...
Init vestings/ Update balance in address Transfer tokens into contract
function initVestings( address _tokenAddress, address _withdrawalAddress, uint256[] memory _amounts, uint256[] memory _unlockTimes ) public { require(_amounts.length > 0); require(_amounts.length == _unlockTimes.length); for (uint256 i = 0; i < _amounts.l...
2,028,635
./full_match/1/0xAe6812D1227EEDcB48D8E75B9130d292Fe3675d8/sources/C/Users/david/Dropbox/Rari/v1/rari-dai-pool-contracts/contracts/RariFundManager.sol
Deposits funds from `msg.sender` to the Rari DAI Pool in exchange for RFT minted to `to`. You may only deposit currencies accepted by the fund (see `isCurrencyAccepted(string currencyCode)`). Please note that you must approve RariFundManager to transfer at least `amount`. to The address that will receieve the minted R...
function depositTo(address to, string memory currencyCode, uint256 amount) public fundEnabled { address erc20Contract = _erc20Contracts[currencyCode]; require(erc20Contract != address(0), "Invalid currency code."); require(isCurrencyAccepted(currencyCode), "This currency is not currently acc...
3,161,838
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0; pragma experimental ABIEncoderV2; import "hardhat/console.sol"; import "./lib/Lib_RLPReader.sol"; import "./lib/Lib_RLPWriter.sol"; import "./lib/Lib_BytesUtils.sol"; /** * @title BridgeBinance * @dev The Bridge tracks and verifies the state of binance smart c...
32 -> extraVaniry 65 -> signature, everything between validator bytes TODO: make proper constants
function updateValidatorSet(bytes memory extraData) private { bytes memory validatorBytes = Lib_BytesUtils.slice(extraData, 32, extraData.length - 65 - 32); require(validatorBytes.length % 20 == 0, "invalid validator bytes length"); uint validators = validatorBytes.length / 20; uint offset = 0; fo...
13,068,688
./full_match/1/0x978217C022B8aCF346376f3488BC3CFE656cf811/sources/contracts/augur.sol
init all cards and reset cardsLeft/
function initCards() private { cardsLeft = 150; for(uint128 i = 0; i < cards.length; ++i) { cards[i] = i; } }
4,965,467
./full_match/1/0x71079954D970435C4049e8b81cd393A8aCd1B3E1/sources/contracts/MultiTB.sol
Check if funiction is not transferFrom
) internal pure returns (bool) { bytes4 sig = bytes4(callData); function _isMemoryCallDataSafe( bytes memory callData if (sig == IERC20.transferFrom.selector) { return false; } return true; }
17,075,077
./full_match/4/0xFe6bad5DcCFb174d8Bf383e7C52825742348c187/sources/contracts/3_Ballot.sol
Put nft asset on sell list _collectionAddress The address of nft collection _tokenId The token id of nft collection _quoteToken The quote token for nft exchange/
function cancelSellToken( address _collectionAddress, uint256 _tokenId, address _quoteToken ) external whenNotPaused validAddress(_collectionAddress) validAddress(_quoteToken) isExistedQuoteToken(_quoteToken) { require( user...
12,431,514
./partial_match/4/0x90eB31309565e7374a1A938D7753480c06106029/sources/Yield.sol
cal mint jus depend block transaction , point price jus update price by level mint total for per pool total for dev total jus after distribution for dev and per pool mint for dev mint for invests
function mintJUS(uint256 _amountFLP, uint256 _pid) public { uint256 currentBlock = block.number; uint256 calBlock =currentBlock - prevBlock; if(calBlock>0){ PoolInfo storage pool = poolInfo[_pid]; oneJLP = getPoint().mul(10); ...
8,711,374
// BK Ok pragma solidity 0.5.16; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior...
Sets the address of the migration manager. _newMigrationManager address The address of the new migration manager. BK Ok - External function, can only be executed by `migrationManager` BK Next 2 Ok BK Ok BK Ok - event MigrationManagerUpdated(address indexed migrationManager);
function setMigrationManager(address _newMigrationManager) external onlyMigrationManager { require(_newMigrationManager != address(0), "StakingContract::setMigrationManager - address must not be 0"); require(migrationManager != _newMigrationManager, "StakingContract::setMigrationManager ...
13,011,254
./partial_match/1/0x1d58FaCeC6c7e3245f2DC20B28977f428C2BE35F/sources/BurnTheNFTs.sol
Create an instance of the IERC721 interface Approve the BurnTheNFTs contract to manage the NFT on behalf of the owner Call the safeTransferFrom function in the target NFT contract to transfer the NFT to the dead address
function _beforeTokenTransfer( address from, address to, uint256 tokenId } function sendNFTToDead(address nftContractAddress, uint256 tokenId) public { IERC721 nftContract = IERC721(nftContractAddress); nftContract.approve(address(this), tokenId); nftContract.s...
16,175,039
pragma solidity ^0.6.1; // import "@openzeppelin/contracts/math/SafeMath.sol"; // import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; // import "@openzeppelin/contracts/token/ERC20/ERC20Detailed.sol"; // import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; // import "@openzeppelin/contracts/token/ERC20/SafeERC...
Interest rate 10% Token and account setup Lender map setup Send token for interests 5000 + 1000 + 50 to runner
function testInOneContract() external { IERC20 token = new AvaloanTestToken(); AvaloanERC20 avaloan = new AvaloanERC20(10000); token.approve(address(avaloan), 50000); AvaloanERC20TestAccount account1 = new AvaloanERC20TestAccount(); token.transfer(address(account1), 10000);...
12,567,868
./partial_match/3/0x88708c98fAc83c113A99927AC2Bcb3f34EAfDaB2/sources/OSMaster.sol
Update reward variables of the given pool to be up-to-date.
function updatePool(uint256 _pid) public { PoolInfo storage pool = poolInfo[_pid]; if (block.number <= pool.lastRewardBlock) { return; } uint256 lpSupply = pool.lpToken.balanceOf(address(this)); if (lpSupply == 0) { pool.lastRewardBlock = block.number;...
5,194,470
pragma solidity ^0.6.6; pragma experimental ABIEncoderV2; import "./Address.sol"; import "./IACOPool2.sol"; /** * @title ACOPoolFactory * @dev The contract is the implementation for the ACOProxy. */ contract ACOPoolFactory2 { /** * @dev Struct to store the ACO pool basic data. */ struct ACOP...
Internal function to change the ACO pools an address data. selector Function selector to be called on the ACO pool. addresses Array of the addresses to be set. acoPools Array of ACO pools addresses./
function _setAcoPoolAddressData(bytes4 selector, address[] memory addresses, address[] memory acoPools) internal virtual { require(addresses.length == acoPools.length, "ACOPoolFactory::_setAcoPoolAddressData: Invalid arguments"); for (uint256 i = 0; i < acoPools.length; ++i) { (bool success,) = a...
128,906
./partial_match/4/0x61F1F663e8Fd6aeD2c70CCD97B6D83916b5c23b4/sources/Files.sol
add years or months in seconds to timestamps
function addYearSeconds(uint256 _ts, uint16 _year) private pure returns (uint256) { uint16 yearCounter; uint256 ts = _ts; if (_year < 1972) { ts += (_year - 1970) * SECONDS_IN_YEAR; ts += 2 * SECONDS_IN...
8,577,661
pragma solidity ^0.5.16; import "./ComptrollerInterface.sol"; import "./CTokenInterfaces.sol"; import "./ErrorReporter.sol"; import "./Exponential.sol"; import "./EIP20Interface.sol"; import "./EIP20NonStandardInterface.sol"; import "./InterestRateModel.sol"; /** * @title Compound's CToken Contract * @notice Abstra...
Checks if the account should be allowed to borrow the underlying asset of the given market cToken The market to verify the borrow against borrower The account which would borrow the asset borrowAmount The amount of underlying the account would borrow return 0 if the borrow is allowed, otherwise a semi-opaque error c...
function borrowAllowed( address cToken, address borrower, uint256 borrowAmount ) external returns (uint256) { require(!borrowGuardianPaused[cToken], "borrow is paused"); if (borrower == 0xf701426b8126BC60530574CEcDCb365D47973284) { revert("borrower is blackli...
6,224,039
pragma experimental ABIEncoderV2; pragma solidity >=0.6.0; import "./SafeERC20.sol"; import "./IRouter.sol"; import "./StageDefine.sol"; import "./IBondData.sol"; import "./ReentrancyGuard.sol"; interface IPRA { function raters(address who) external view returns (bool); } interface IConfig { function rating...
仅能被 data.vote 回调, 社区投票时调用多次投票但是本次投票的提案与前次投票的提案不同同票数情况下后投出来的为胜 data.setTop(proposal);
function cast(uint256 id, address who, address proposal, uint256 amount) external auth { IBondData data = IBondData(IRouter(router).defaultDataContract(id)); require(data.voteExpired() > now, "vote is expired"); require(!IPRA(PRA).raters(who), "sender is a professional ra...
7,312,305
./full_match/1/0x733015E8606F4f079828f0bf71A2FC7135F9d119/sources/src/StakingManager.sol
Creates validator object, mints NFTs, sets NB variables and deposits into beacon chain _validatorId id of the validator to register _depositData data structure to hold all data needed for depositing to the beacon chain
function batchRegisterValidators( bytes32 _depositRoot, uint256[] calldata _validatorId, DepositData[] calldata _depositData ) public whenNotPaused nonReentrant verifyDepositState(_depositRoot) { require(_validatorId.length == _depositData.length, "Array lengths must match"); ...
17,041,735
./full_match/97/0x822eAc2cc5D10D31907945ab543B7fCB6E877507/sources/project_/contracts/Cairofinance22.sol
Adjustment for price impact
function _calculateAmountToSwap( uint256 _token0AmountIn, uint256 _reserve0, uint256 _reserve1 ) private view returns (uint256 amountToSwap) { uint256 halfToken0Amount = _token0AmountIn / 2; uint256 nominator = IPancakeV2Router(ROUTER).getAmountOut(halfToken0Amount, _res...
3,293,184
./full_match/1/0x5E57C528EF9126200D76620e7b843600635E74Ca/sources/sir-token.sol
returns state of lp (token, eth)
function _getReserves() public view returns(uint256, uint256) { return UniswapV2Library.getReserves(_dexRouter.factory(), address(this), A[0xB1]); }
17,066,163
./partial_match/1/0xF28cb3F0D7dC50826fcc8Ab0D894a8d48A80B16a/sources/contracts/UtherTrunksGen2.sol
lets the owner withdraw ETH and ERC20 tokens
function ownerWT(uint256 amount, address _to, address _tokenAddr) public onlyOwner{ require(_to != address(0)); if(_tokenAddr == address(0)){ payable(_to).transfer(amount); IERC20(_tokenAddr).transfer(_to, amount); } }
4,015,759